[Web4lib] HTML question

Araby Y Greene araby at unr.edu
Tue Apr 18 20:39:25 EDT 2006


You can use "margin: 0 auto;" with images in IE with an XHTML 4.01 Strict or XHTML doctype, if styled as a block element: 

display: block; margin: 0 auto;

If you go to the trouble of using these css styles, may as well add the width, height, and border properties to the css:

display: block; margin: 0 auto; width: 600px; height: 300px; border: none;


-araby

__________________________
Araby Greene
Web Development Librarian
Getchell Library/322
University of Nevada, Reno
http://www.library.unr.edu/

araby at unr.edu
775.784.6500 x343

     /|
  \'o.O'
  =(___)=
    U
ACK! THPTPHH!



> -----Original Message-----
> From: web4lib-bounces at webjunction.org [mailto:web4lib-
> bounces at webjunction.org] On Behalf Of lib
> Sent: Tuesday, April 18, 2006 5:18 PM
> To: web4lib at webjunction.org
> Subject: Re: [Web4lib] HTML question
> 
> hi Lynne,
> 
> to get horizontal centering on an element, use:
> margin:0 auto;
> 
> of course that won't work in IE, you will need to use text-align:center;
> on
> the element's container (and reset it to left on the element itself if
> necessary).
> 
> http://css-discuss.incutio.com/?page=CenteringBlockElement
> http://www.yourhtmlsource.com/stylesheets/csslayout.html#centering
> 
> v.
> 
> 
> 
> At 05:09 PM 18/04/2006 -0600, you wrote:
> >Howdy, folks,
> >This is so basic I feel quite dumb for even asking, but anyway:
> >I have been reading the HTML 4.0.1 specs in an effort to get my pages to
> >validate. One of the things it says is that IMG ALIGN attributes are
> >bottom, middle, top, left, right. Middle is a vertical attribute. So how
> >does one center an image on a webpage horizontally? I have been blithely
> >using "align=center" for years, which has always worked fine, but it's
> >not valid. I don't want to center every image on all my webpages - do I
> >have to add yet another class to my already innumerable CSS classes?
> >Lynne
> >--
> >L. E. Puckett
> >Reference & Electronic Systems Librarian
> >Parmly Billings Library
> >510 North Broadway, Billings, MT 59101
> >http://www.billings.lib.mt.us
> >Ph: 406-657-8258
> >
> >_______________________________________________
> >Web4lib mailing list
> >Web4lib at webjunction.org
> >http://lists.webjunction.org/web4lib/
> >
> _______________________________________________
> Web4lib mailing list
> Web4lib at webjunction.org
> http://lists.webjunction.org/web4lib/


More information about the Web4lib mailing list