Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / May 2006



Tip: Looking for answers? Try searching our database.

Newbie: How to align images with CSS?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
deko - 29 May 2006 06:12 GMT
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.
Mark Parnell - 29 May 2006 06:22 GMT
Deciding to do something for the good of humanity, deko
<deko@nospam.com> declared in
comp.infosystems.www.authoring.stylesheets:

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

Signature

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

deko - 29 May 2006 08:37 GMT
> 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.

> 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
deko - 29 May 2006 17:42 GMT
Here is the revised link:

http://host205.ipowerweb.com/~clearpoi/test/index.html
ironcorona - 29 May 2006 06:46 GMT
> I've tried this:
>
[quoted text clipped - 11 lines]
>
> 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?

Signature

Brian O'Connor (ironcorona)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.