I have a div element whose height I set with em, and whose width I set as a percentage. There is an image contained within. It has a width as a percentage (83%). However, if I am at a resolution where that div element is starting to get a little narrow, the image narrows up as well, but rather than taking up the entire div (as it should), the image just becomes small and appears just at the top of the div. To compensate for this, I want to vertically align my image within the div element. How can I do this?
I have a div element whose height I set with em , and whose
Share
vertical-align does not work in
DIVelements. the only way to do this is to set this property to your div in css :after it, your
DIVelement will act likeTDelemnt of Table.to align your image in div with specifying percentage for image vertical position look at link bellow (percentage value) :
http://reference.sitepoint.com/css/vertical-align