A aaronfalloon Established Member ★ 20 ★ Impact 6 Feb 23, 2006 730 views 9 replies #1 How do you center an image using CSS? Thanks in advance. Last edited: Feb 23, 2006
painperdu Established Member ★ 20 ★ Impact 31 Feb 23, 2006 #2 The image needs to be in a container and then use 'text-align'.
stscac A Wealth of KnowledgeVIP Member VIP ★ 20 ★ Impact 73 Feb 23, 2006 #3 The whole thing would look like this: Code: text-align:center; -Steve
A aaronfalloon Established Member ★ 20 ★ Impact 6 Feb 23, 2006 #4 I read somewhere were that wasn't the recomended way, is there any other methods?
Jim_ Established Member ★ 20 ★ Impact 33 Feb 23, 2006 #5 Code: margin-left: auto; margin-right auto; You might need to set width, but that should work.
stscac A Wealth of KnowledgeVIP Member VIP ★ 20 ★ Impact 73 Feb 23, 2006 #6 What other method with CSS is there? You can either use css in the header of your file, an external style sheet, or, within an image tag directly in its CSS "style" attribute. I use the first two regularly, but the third is not my favorite. -Steve
What other method with CSS is there? You can either use css in the header of your file, an external style sheet, or, within an image tag directly in its CSS "style" attribute. I use the first two regularly, but the third is not my favorite. -Steve
Tree Established Member ★ 15 ★ Impact 9 Feb 23, 2006 #7 Here's a one I found using The Anointed One. I haven't tested it myself, so it may or may not work. Code: <div style="text-align: center;"> <div style="text-align: left; margin: 1em auto; width: 50%;"> </div> </div>
Here's a one I found using The Anointed One. I haven't tested it myself, so it may or may not work. Code: <div style="text-align: center;"> <div style="text-align: left; margin: 1em auto; width: 50%;"> </div> </div>
A aaronfalloon Established Member ★ 20 ★ Impact 6 Feb 23, 2006 #8 Thanks for the help guys, only the first method seems to be working. Thanks again.
jmweb Account Closed Impact 16 Feb 26, 2006 #9 you could also use Code: <img src="file.jpg" align="center">
A aaronfalloon Established Member ★ 20 ★ Impact 6 Feb 26, 2006 #10 I don't think thats using CSS but thanks anyway.