Mencarta Posted January 9, 2010 Share Posted January 9, 2010 I'm trying to align an image and this code doesn't work. #logo {margin-left:auto;margin-right:auto;} Any suggestions? Link to comment Share on other sites More sharing options...
Ingolme Posted January 9, 2010 Share Posted January 9, 2010 An image is an inline element. You need to give text-align: center to the parent element to make it centered. Link to comment Share on other sites More sharing options...
Mencarta Posted January 9, 2010 Author Share Posted January 9, 2010 Thanks. Link to comment Share on other sites More sharing options...
thescientist Posted January 9, 2010 Share Posted January 9, 2010 what if you set it to display: block? Link to comment Share on other sites More sharing options...
Mencarta Posted January 9, 2010 Author Share Posted January 9, 2010 If one solution works why create a new one? Link to comment Share on other sites More sharing options...
thescientist Posted January 9, 2010 Share Posted January 9, 2010 Actually that was more of a question for Ingolme. I was just trying to seek out from him if that was also a viable solution; it never hurts to know how to do things in different ways. Link to comment Share on other sites More sharing options...
Ingolme Posted January 9, 2010 Share Posted January 9, 2010 Actually that more of a question for Ingolme. I was just trying to seek out from him if that was also a viable solution; it never hurts to know how to do things in different ways. display: block would center it if it has margin: auto set. But it removes the inline behaviour of the image, like being able to be on the same line as text and other images. It all depends on what you're doing with the image. Link to comment Share on other sites More sharing options...
thescientist Posted January 9, 2010 Share Posted January 9, 2010 and the inline behavior is how one would achieve text wrapping around an image? (with a float setting applied to the image?) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.