Previous Message
Next Message

How to vertically center img in div?

Sent by Paul Novitski on 21 September 2004 20:08

At 11:15 AM 9/21/2004, Roger Martin wrote:
>How can I vertically center an image in a div?
><div style="width:300px;height:300px;">
><img src="..." style="width:100px;height:100px;" alt="" />


If you don't need to have your img tag in HTML, try this:

         <div id="photo01"></div>

         div #photo01
                 width: 300px;
                 height: 300px;
                 background-image: url("zThumb_000_0103.jpg");
                 background-repeat: no-repeat;
                 background-position: center;


css-discuss [EMAIL-REMOVED]]
List wiki/FAQ --
Supported by --
Previous Message
Next Message

Message thread: