Old 29-10-2006, 12:48   #1 (permalink)
LOI Kratong
Held Together!
 
LOI Kratong's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 30
Send a message via MSN to LOI Kratong
CSS centering issues

Hey,

on my site I'm trying to have all of the thumbnails centred on the white 'content' div. Unfortunately being a fluid layout anything I try seems to fail miserably. Could anyone give me a friendly nudge in the right direction?

One other thing, I trying to make the site as XHTML 1.0 Strict, but am having a few issues, again with centering. If I try and validate it at the minute I get an error, flagging <div align="center"> as being invalid. Does anyone know how I can get around this, using css to center the content but in a strict compliant way?

Thanks!

P.S. Could people refrain from critting the design, I'm gonna post in the showcase where everyone can have a bash once I've got the coding right. Feel free to point out any coding errors or faux pas

Last edited by LOI Kratong : 30-10-2006 at 04:08.
  Reply With Quote
Old 29-10-2006, 12:52   #2 (permalink)
pgo
i'm done, son
 
Join Date: Jan 2005
Posts: 12,262
You can center things by:

<div class="someContainerElement">
<img src="/path/to/image.jpg" />
<p>Caption!</p>
</div>

.someContainerElement {
text-align: center;
}

.someContainerElement img, .someContainerElement p {
margin: 0 auto;
text-align: left;
}

Alternatively, you should be able to use the selector: ".someContainerElement *", which should center everything inside someContainerElement.
  Reply With Quote
Old 29-10-2006, 14:07   #3 (permalink)
LOI Kratong
Held Together!
 
LOI Kratong's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 30
Send a message via MSN to LOI Kratong
That isn't working for me, although I don't doubt the code as I've seen it in many places. My thumbnails are placed as an unordered list, but I'm not sure how to get the entire block of thumbnails centred inside the content div.

Are there any other suggestions?
  Reply With Quote
Old 30-10-2006, 04:03   #4 (permalink)
freelancr
Senior Member
 
freelancr's Avatar
 
Join Date: Oct 2006
Posts: 2,097
File not found, btw:
<div align="centre">

Align isn't used in strict, as you should control it in the css. It would still work, but you spelt center wrong.
  Reply With Quote
Old 30-10-2006, 04:08   #5 (permalink)
LOI Kratong
Held Together!
 
LOI Kratong's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 30
Send a message via MSN to LOI Kratong
Yeah I know that's my issue, how do I control it with the css? I'm trying to convert it to strict by getting rid of these things!
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8