HighDots Forums  

Newbie: How to align images with CSS?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Newbie: How to align images with CSS? in the Cascading Style Sheets forum.



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

Default Newbie: How to align images with CSS? - 05-29-2006 , 12:12 AM






I've tried this:

#some-div img { text-align: left }

but no luck.

What I have is some-div that requires 'text-align: center'

#some-div {

text-align: center;

}

But I want all the images aligned left.

Do I have to do this:

<img align="left" src="/images/some-image.gif">

on every image in the div?

Thanks in advance.


Reply With Quote
  #2  
Old   
Mark Parnell
 
Posts: n/a

Default Re: Newbie: How to align images with CSS? - 05-29-2006 , 12:22 AM






Deciding to do something for the good of humanity, deko
<deko (AT) nospam (DOT) com> declared in
comp.infosystems.www.authoring.stylesheets:

Quote:
What I have is some-div that requires 'text-align: center'
But I want all the images aligned left.
text-align affects all inline content (including images), not just text.
You could float the images to the left, or put them in another container
with text-align: left;

As always a URL would make it easier to be more specific.

--
Mark Parnell
My Usenet is improved; yours could be too:
http://blinkynet.net/comp/uip5.html


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

Default Re: Newbie: How to align images with CSS? - 05-29-2006 , 12:46 AM



deko wrote:
Quote:
I've tried this:

#some-div img { text-align: left }

but no luck.

What I have is some-div that requires 'text-align: center'

#some-div {

text-align: center;

}

But I want all the images aligned left.
Are you trying to align the div in the center of the screen or do you
want the text in the div to be centrally aligned?

If you're trying to put the div in the centre of the screen [or it's
container] then use:

#some-div {margin-left:auto; margin-right:auto;}

If you're trying to align the text to the center of the div and then
have an image in the same div aligned to the left I'm not sure that this
would work. For the purposes of CSS applying text-align:center; covers
all inline elements including images [perhaps the name could've been
slightly clearer]. So perhaps you're looking for a float?


--
Brian O'Connor (ironcorona)


Reply With Quote
  #4  
Old   
deko
 
Posts: n/a

Default Re: Newbie: How to align images with CSS? - 05-29-2006 , 02:37 AM



Quote:
text-align affects all inline content (including images), not just text.
You could float the images to the left, or put them in another container
with text-align: left;
Putting the images in their own div makes sense (I've always had trouble with
cross-browser compatibility with float).

I didn't realize that text-align included images.

Quote:
As always a URL would make it easier to be more specific.
http://www.clearpointsystems.com

As you will see, I want the 'Visitor Log' text to be centered, but the images at
the bottom should be aligned left.

I nest everything in the 'center-right' div for positioning.

One other thing that's annoying is that IE and FireFox never render
padding/spacing the same. Seems like the space between divs never looks the
same, especially if padding is used



Reply With Quote
  #5  
Old   
deko
 
Posts: n/a

Default Re: Newbie: How to align images with CSS? - 05-29-2006 , 11:42 AM



Here is the revised link:

http://host205.ipowerweb.com/~clearpoi/test/index.html


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.