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="" />
>
></div>

Roger,

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;
         }

Paul 


______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: