HighDots Forums  

Center image in DIV?

alt.discuss.html alt.discuss.html


Discuss Center image in DIV? in the alt.discuss.html forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Noozer
 
Posts: n/a

Default Center image in DIV? - 01-13-2004 , 07:03 PM






Why are there no alignment properties that I can use to align an image
within a div?

We haven't finalize our logo so we don't know the final width of the image.
CSS is supposed to be about layout, not content, so the dimensions shouldn't
come into play when defining the style sheet anyhow. At this point we are
going to have to use the <CENTER> tag.

How do I define that any IMG tag should be centered?

P.s. I didn't see any groups dedicated to CSS. Please let me know if there
are any.



Reply With Quote
  #2  
Old   
Noozer
 
Posts: n/a

Default Re: Center image in DIV? - 01-13-2004 , 07:38 PM







"brucie" <shit (AT) bruciesusenetshit (DOT) info> wrote

Quote:
in post <news:bu252c$cp3uq$1 (AT) ID-117621 (DOT) news.uni-berlin.de
brucie said:

whatever{text-align:center:}
^ oops ;
Thanks!

Had to set Display: Block; to get it to work though.




Reply With Quote
  #3  
Old   
Noozer
 
Posts: n/a

Default Re: Center image in DIV? - 01-13-2004 , 07:43 PM



Quote:
We haven't finalize our logo so we don't know the final width of the
image.
CSS is supposed to be about layout, not content, so the dimensions
shouldn't
come into play when defining the style sheet anyhow.

that doesn't make sense
What I mean is that all the solutions that I found needed to know the
dimensions of the image being centered, so the CSS was bound to the specific
content, not just the page layout. CSS is supposed to be about layout, not
content.

The text-align works fine (although doesn't really make much sense, since
this isn't text.)





Reply With Quote
  #4  
Old   
Toby A Inkster
 
Posts: n/a

Default Re: Center image in DIV? - 01-14-2004 , 01:45 AM



brucie wrote:

Quote:
in post <news:B41Nb.84638$ts4.47054@pd7tw3no
Noozer said:

whatever{text-align:center;}

Had to set Display: Block; to get it to work though.

thats a bit odd, a div with text-align:center; will center an image
without having to do anything else.
I think he's using

img { text-align: center; display: block; }

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132



Reply With Quote
  #5  
Old   
Steve Sundberg
 
Posts: n/a

Default Re: Center image in DIV? - 01-14-2004 , 09:20 PM



On Wed, 14 Jan 2004 01:43:40 GMT, "Noozer" <postmaster (AT) 127 (DOT) 0.0.1>
wrote:
Quote:
What I mean is that all the solutions that I found needed to know the
dimensions of the image being centered, so the CSS was bound to the specific
content, not just the page layout. CSS is supposed to be about layout, not
content.
That's no different than a designer, laying out a page, having to
block out an finite space alongside a column of copy. That is very
much about layout and has nothing to do with any text content.

You can always change the <div> dimensions later, y'know, once you've
established the final size of your logo.

Quote:
The text-align works fine (although doesn't really make much sense, since
this isn't text.)
Well, in a sense it is textural -- in that you're including the image
within the body you've created as a <div>.



Reply With Quote
  #6  
Old   
Noozer
 
Posts: n/a

Default Re: Center image in DIV? - 01-14-2004 , 09:29 PM




"Toby A Inkster" <UseTheAddressInMySig (AT) deadspam (DOT) com> wrote

Quote:
brucie wrote:

in post <news:B41Nb.84638$ts4.47054@pd7tw3no
Noozer said:

whatever{text-align:center;}

Had to set Display: Block; to get it to work though.

thats a bit odd, a div with text-align:center; will center an image
without having to do anything else.

I think he's using

img { text-align: center; display: block; }
div.menu img {
display: block;
text-align: center;
vertical-align: center;
margin: 3px;
}

....to be exact




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.