markduce Posted November 9, 2011 Share Posted November 9, 2011 Hello, This one's causing me to tear my hair out, so I'd be very grateful of any help/ So the img align attribute is deprecated nowadays right? Well I have a load of images in a table, where everything but the images is aligned to the center using css text-align. I want the images to be centrally aligned too. Well, I don't really mind, but the client thinks it's really important.... I've tried adding float:none style to the images but that had no effect, anyone got any ideas? To see the images in place, they are in the table in the link below with all the ticks and crosses. http://www.menuanalyser.co.uk/chef-recipe-costing Any advice much appreciated Regards Mark Quote Link to comment https://forums.phpfreaks.com/topic/250758-image-aligning-in-a-table/ Share on other sites More sharing options...
denno020 Posted November 9, 2011 Share Posted November 9, 2011 If you make img a block element, and then use margin: auto, that will centre the image. img{margin:0 auto; display: block;} try that Quote Link to comment https://forums.phpfreaks.com/topic/250758-image-aligning-in-a-table/#findComment-1286621 Share on other sites More sharing options...
AyKay47 Posted November 11, 2011 Share Posted November 11, 2011 If you make img a block element, and then use margin: auto, that will centre the image. img{margin:0 auto; display: block;} try that display: inline-block; rather, should be able to text-align: center; then.. Quote Link to comment https://forums.phpfreaks.com/topic/250758-image-aligning-in-a-table/#findComment-1287386 Share on other sites More sharing options...
markduce Posted December 9, 2011 Author Share Posted December 9, 2011 Fantastic, that sorted it, thank you both. Quote Link to comment https://forums.phpfreaks.com/topic/250758-image-aligning-in-a-table/#findComment-1296143 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.