On Mar 17, 10:08am, Harris Kosmidhs
<hkosm...@remove.me.softnet.tuc.gr> wrote:
> Ben C wrote:
> > On 2008-03-14, raj <r...@nospam.com> wrote:
> >> Hi everyone,
>
> >> I'm a newbie and can;t get this code to work. It is supposed to center
> >> the text block within the wrap, but the centering won't work.
>
> > You can't centre a float. It floats to one side or the other.
>
> Though I know that and I can understand it I was wondering of the
> following senario:
>
> I have a div with width 100% (so it goes it fills the whole viewport). I
> want a div inside it with some pictures:
>
> <div id="wrap">
> <div>
> <img src="blah.jpg"> <img src="blah1.jpg"> <img src="blah2.jpg"> <img
> src="blah3.jpg">
> </div>
> </div>
>
> By default #wrap div will also have width:100%. What if I want the div
> containing the imgs to be centered. The only way I know is to explicit
> set the width like:
>
> #wrap div img {margin-left:2em}
> #wrap div {width:50em;margin:0 auto}
>
> But I don't know the overall width of the images, so it's wrong to set a
> width. How can I accomplish that?
>
> thanks in advance
Maybe I don't understand exactly what you are looking for, but if you
just want the images centered, why not just put a declaration of text-
align: center on the img's container?
E.g.:
#wrap div {text-align: center}
Nick
--
Nick Theodorakis
nick_theodorakis@hotmail.com
contact form:
http://theodorakis.net/contact.html