Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Old 05-10-2011, 09:45 AM centered pics
Skilled Talker

Posts: 69
Name: Greg
Location: South Carolina
Trades: 0
http://outdoorsindoors.net/DEV/MLB2/...owprod&catid=1

looks the way I want in FF, not in IE. in ie they are stacked on top of each other. I am learning a lot about the differences of IE vs FF regarding css but cant spot this one.

I can apply a float left to the thumbnail container and they will be on the same line, but obviously over to the left


Css for the items is
Code:
<!--Container for product thumbnails-->
.thrColFixHdr #container #mainContent .ProdCatalog{
margin-left:auto; 
margin-right:auto; 
text-align:center; 
width:995px;  
padding:10px;  }
<!--Style for each thumbnail (includes img, name, price)-->
.thrColFixHdr #container #mainContent .ProdCatalog .ProdThumb {
font-weight:bold; 
font-size:16px; 
text-decoration:none;  
text-align:center;  
width:250px; 
display:inline-block;  }
<!--style for a element link-->
.thrColFixHdr #container #mainContent .ProdCatalog .ProdThumb a{
font-weight:bold; 
font-size:16px; 
text-decoration:none; }
scuts is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-10-2011, 11:59 AM Re: centered pics
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
Without looking into it very much my first "advice" would be to use float left, wrap them in a div and then center the div.
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 05-10-2011, 12:18 PM Re: centered pics
Skilled Talker

Posts: 69
Name: Greg
Location: South Carolina
Trades: 0
thanks for the tip. I gave that I try which I had many times without it working. This time dropped the width of the div that I had the thumbnails in. That allowed it to work.

Not real sure why, I wanted the container div to be full width while the thumbnail divs were a relative side and centered. either way it looks fine in both IE and FF.

the learning process continues .... thanks again
scuts is offline
Reply With Quote
View Public Profile
 
Old 05-10-2011, 12:34 PM Re: centered pics
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
set the container with text-align: center; and set the images to display: inline;
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-10-2011, 12:45 PM Re: centered pics
Skilled Talker

Posts: 69
Name: Greg
Location: South Carolina
Trades: 0
the images are actually containers themselves though with an image a title and a price in it which are all href links. would this still work with that approach?

also any downfalls to how I currently have it working based on lizciz's feedback

Code:
.thrColFixHdr #container #mainContent .ProdCatalog{
margin-left:auto; 
margin-right:auto; 
text-align:center; 
width:750px; 
margin-top:10px; 
margin-bottom:10px; }
.thrColFixHdr #container #mainContent .ProdCatalog .ProdThumb {
font-weight:bold; 
font-size:12px; 
text-decoration:none;  
text-align:center;  
width:250px; 
float:left;}
.thrColFixHdr #container #mainContent .ProdCatalog .ProdThumb a{
font-weight:bold; 
font-size:12px; 
text-decoration:none; 
line-height:12px;}
scuts is offline
Reply With Quote
View Public Profile
 
Old 05-10-2011, 03:19 PM Re: centered pics
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You can only put an image in an image container.

I take it you mean you have a container with a image and text contained in it?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-10-2011, 03:22 PM Re: centered pics
Skilled Talker

Posts: 69
Name: Greg
Location: South Carolina
Trades: 0
correct. i know the code is ugly below because it is html in php but this is what it is doing.

<div>image, price, link</div>

Code:
 echo"<div class=\"ProdThumb\">
      <a href=\"index.php?page=mods/Products/itemdetail&itemid=".$prod['id']."\">
      <img src=\"".$img." \" width=\"".$pref['item_thumb_width']."\" border=\"0\"><p>".$prod["name"]."</p><p>".$price."</a></p>
      </div>\n";
scuts is offline
Reply With Quote
View Public Profile
 
Old 05-10-2011, 04:06 PM Re: centered pics
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
Of course there are many ways to center something. But I normally put the thing(s) i want to center in a container and set its' horizontal margin to auto. This requires the container to have a limited width though. By default a div stretches horizontally to cover all available area, which means it wouldn't be centered at all. So I either use a fixed width (width:?? px; ) or make it behave like a table (display:table; ) since it will then instead use a minimal width that still makes room for its' contents.
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 05-10-2011, 04:13 PM Re: centered pics
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Where are the captions set?

alongside with the image left or right?
Below the image?
Or above the image?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-10-2011, 04:17 PM Re: centered pics
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Oh and is the idea for the images to start from the centre then "bump" the leftmost image further left each time?

The mythical "float: center;" property?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-13-2011, 07:46 PM Re: centered pics
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Why are you guys going at this image centering the hard way?
If the image is inside a div or 'container' already, just do this:

Quote:
.container-name img{
display:block;
margin: xx auto;
}
You're done, the image already has it's width, all you do is make it a block and center it.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 05-17-2011, 09:59 AM Re: centered pics
Skilled Talker

Posts: 60
Name: Dmitry
Trades: 0
Quote:
Originally Posted by LadynRed View Post
Why are you guys going at this image centering the hard way?
If the image is inside a div or 'container' already, just do this:

You're done, the image already has it's width, all you do is make it a block and center it.
For IE as I know must be also a text-align:center
__________________
Sincerely, Dmitry

Please login or register to view this content. Registration is FREE
ElmanF is offline
Reply With Quote
View Public Profile Visit ElmanF's homepage!
 
Old 05-17-2011, 10:34 AM Re: centered pics
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by ElmanF View Post
For IE as I know must be also a text-align:center
For IE5 & 5.5 yes, however as they are long dead, they don't really count.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to centered pics
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.18378 seconds with 12 queries