Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Center image in DIV?

Reply
Thread Tools

Center image in DIV?

 
 
Noozer
Guest
Posts: n/a
 
      01-14-2004
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
 
 
 
 
brucie
Guest
Posts: n/a
 
      01-14-2004
in post <news:az0Nb.83636$X%5.45527@pd7tw2no>
Noozer said:

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


whatever{text-align:center:}

> 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

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


comp.infosystems.www.authoring.stylesheets


--
brucie
 
Reply With Quote
 
 
 
 
brucie
Guest
Posts: n/a
 
      01-14-2004
in post <news:bu252c$cp3uq$(E-Mail Removed)-berlin.de>
brucie said:

> whatever{text-align:center:}

^ oops ;


--
brucie
 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      01-14-2004
On Wed, 14 Jan 2004 01:03:02 GMT, Noozer declared in
alt.discuss.html,alt.html:

[alt.discuss.html trimmed as it doesn't exist on my news server]

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


There is. An image is inline content, so text-align is the one you are
looking for.

>
> 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.


Bah! Deprecated rubbish.

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


text-align: center;

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


news:comp.infosystems.www.authoring.stylesheets

--
Mark Parnell
http://www.clarkecomputers.com.au
 
Reply With Quote
 
Noozer
Guest
Posts: n/a
 
      01-14-2004

"brucie" <****@bruciesusenetshit.info> wrote in message
news:bu2583$cnppc$(E-Mail Removed)-berlin.de...
> in post <news:bu252c$cp3uq$(E-Mail Removed)-berlin.de>
> brucie said:
>
> > whatever{text-align:center:}

> ^ oops ;


Thanks!

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


 
Reply With Quote
 
Noozer
Guest
Posts: n/a
 
      01-14-2004
> > 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
 
brucie
Guest
Posts: n/a
 
      01-14-2004
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.

--
brucie
 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      01-14-2004
On Wed, 14 Jan 2004 01:43:40 GMT, Noozer declared in
alt.discuss.html,alt.html:
>
> The text-align works fine (although doesn't really make much sense, since
> this isn't text.)


But an image is still inline content. Though you said that you had to
specify display: block; on it, which makes it not inline content.

Let me guess: you are using Internet Explorer to test. Probably in
"quirks" mode. Internet Explorer is broken. You shouldn't use it as your
primary test browser.

More info on centring:
http://dorward.me.uk/www/centre/

--
Mark Parnell
http://www.clarkecomputers.com.au
 
Reply With Quote
 
Noozer
Guest
Posts: n/a
 
      01-14-2004

"Mark Parnell" <(E-Mail Removed)> wrote in message
news:1i0rvge7wg1xa.b0qa6dnb8vni$(E-Mail Removed)...
> On Wed, 14 Jan 2004 01:43:40 GMT, Noozer declared in
> alt.discuss.html,alt.html:
> >
> > The text-align works fine (although doesn't really make much sense,

since
> > this isn't text.)

>
> But an image is still inline content. Though you said that you had to
> specify display: block; on it, which makes it not inline content.
>
> Let me guess: you are using Internet Explorer to test. Probably in
> "quirks" mode. Internet Explorer is broken. You shouldn't use it as your
> primary test browser.


I know what you mean... It's not my test browser though, it's my target
browser.

I think that the W3C (or whoever makes the rules for CSS) should develop a
common rendering/interpretation engine that the browser makes could include
in their builds. This would ensure 100% compliance.


 
Reply With Quote
 
William Tasso
Guest
Posts: n/a
 
      01-14-2004
Noozer wrote:
> ...
> I think that the W3C (or whoever makes the rules for CSS) should
> develop a common rendering/interpretation engine that the browser
> makes could include in their builds. This would ensure 100%
> compliance.


Good plan - and you called brucie a nazi - go for it ;o)

--
William Tasso - http://WilliamTasso.com


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
align a image in xhtml ( center ? ) Mark Strain HTML 9 01-10-2009 05:01 PM
Centering image without <center> fantababy HTML 13 04-21-2006 04:40 PM
center image horizontally?? David Stiles HTML 11 11-21-2005 12:08 AM
Naming of core NASA center with the words "Mission Control Center" & mass use of religious anthem sounding word "Mission" in Context of Space Exploration & the Moon Landing Hoax moonlandinghoaxreligious@yahoo.com Digital Photography 0 09-27-2005 08:28 PM
mouseover to show image in center Richard HTML 0 09-05-2003 07:20 PM



Advertisments