HighDots Forums  

Centering images

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


Discuss Centering images in the Cascading Style Sheets forum.



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

Default Centering images - 06-26-2004 , 01:56 PM






Hi!

I'm having a little problem with my site. I know how to center DIVs
using the "margin: auto" thing. But I'm unable to center two images.
I used the "text-align: center" hack with no results, too.

Here is my site:

http://project.fotografist.com/


and the CSS:

http://project.fotografist.com/styles/styles_black.css


Basically, I need to center the images in the "photos" DIV.


Can someone help me, please ?


thanks in advance

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

Default Re: Centering images - 06-26-2004 , 02:03 PM






Abs wrote:

Quote:
Hi!

I'm having a little problem with my site. I know how to
center DIVs
using the "margin: auto" thing. But I'm unable to center
two images. I used the "text-align: center" hack with no
results, too.

Here is my site:

http://project.fotografist.com/


and the CSS:

http://project.fotografist.com/styles/styles_black.css


Basically, I need to center the images in the "photos" DIV.


Can someone help me, please ?
I'm not sure what it is you want: center them one below the
other? or next to each other?

You are using float:left on the div which surrounds the first
img, this will never get it centered. Float:left means left,
not centered.
Also you don't need to put divs around the img's, you can
apply the styles to the img elements themselves.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -


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

Default Re: Centering images - 06-26-2004 , 02:06 PM



Els wrote:

Quote:
I'm not sure what it is you want: center them one below the
other? or next to each other?
yes, one next to the other.

Quote:
You are using float:left on the div which surrounds the first
img, this will never get it centered. Float:left means left,
not centered.
Also you don't need to put divs around the img's, you can
apply the styles to the img elements themselves.

Ok, I'll try with no DIVs surrounding the images.


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

Default Re: Centering images - 06-26-2004 , 02:09 PM



Abs wrote:

Quote:
Els wrote:


I'm not sure what it is you want: center them one below the other? or
next to each other?


yes, one next to the other.

You are using float:left on the div which surrounds the first img,
this will never get it centered. Float:left means left, not centered.
Also you don't need to put divs around the img's, you can apply the
styles to the img elements themselves.


Ok, I'll try with no DIVs surrounding the images.
Great, it works now. But I don't know if the text-align hack is the
right way to do it. Anyways...


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

Default Re: Centering images - 06-26-2004 , 02:21 PM



Abs wrote:

Quote:
Abs wrote:

Els wrote:


I'm not sure what it is you want: center them one below
the other? or next to each other?


yes, one next to the other.

You are using float:left on the div which surrounds the
first img, this will never get it centered. Float:left
means left, not centered. Also you don't need to put divs
around the img's, you can apply the styles to the img
elements themselves.

Ok, I'll try with no DIVs surrounding the images.

Great, it works now. But I don't know if the text-align
hack is the right way to do it. Anyways...
You must notice though, that in IE, if the window is narrower
than the width of the two pictures, it won't be centered
anymore. In Gecko browsers, it will remain centered, thus
'losing' the left side of the left picture, where no scrollbar
will go. In IE, the left border of the left picture will stop
when touching the left side of the window, while the column
will remain centered.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -


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.