On 27-Apr-04, at 12:36 PM, Paul Ingraham wrote:

To center an img using css, is it really necessary to do this?



use this:

<img src="diagram12.jpg" width="350" height="200" id="largediagram">

are there going to be many largediagrams? If only one, use id, if many, use class

then:

#largediagram {
        text-align: center;
}

or

#largediagram {
        display: block;
        margin: 0 auto;
}

text-align works on any inline object directly, so you can apply it directly to the image itself, or just make the image a block-level object and put margins on it. Either way the p tag is superfluous. I hope that helped..


Nelson Ford ------------------------------------------- Geo: Vancouver, BC Net: www.nelsonford.net

*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************




Reply via email to