loonie35 Posted February 23, 2009 Share Posted February 23, 2009 How to make div valign="center"/vertical-align:middle;? Valign for me works only with table/td. Link to comment Share on other sites More sharing options...
loonie35 Posted February 25, 2009 Author Share Posted February 25, 2009 none? Link to comment Share on other sites More sharing options...
jeffman Posted February 25, 2009 Share Posted February 25, 2009 This is one of the remaining weaknesses in HTML. Some elements change their own alignment when vertical-align is set. Others change the alignment of things that they contain. An ordinary div cannot center its contents vertically with the vertical-align property. So vertical-alignment is a weird property.A trick sometimes used to to set the display property of a div to table-cell. vertical-align: center will then work in most browsers (it might even be the default? I don't recall). But this trick does not work in IE. Just as bad, vertical-align is not compatible with the float property. Add a float property, and the vertical-alignment fails.Some hacks are available here: http://www.google.com/search?q=css+vertical+centering Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.