Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1628 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

Center content on page

Thread title: Center content on page
Closed Thread  
Page 2 of 2 < 1 2
    Thread tools Search this thread Display Modes  
08-22-2005, 01:45 AM
#11
SamOwen is offline SamOwen
SamOwen's Avatar
Status: Member
Join date: Aug 2005
Location:
Expertise:
Software:
 
Posts: 127
iTrader: 0 / 0%
 

SamOwen is on a distinguished road

  Old

Originally Posted by Paul
.container {
margin: auto:
}

Thats what I would do. All that other crap is ridiculous.
Exactly what I thought when I first saw all that code.

08-22-2005, 05:02 AM
#12
<Isurfr> is offline <Isurfr>
Status: Member
Join date: Aug 2005
Location: w3c
Expertise:
Software:
 
Posts: 193
iTrader: 0 / 0%
 

<Isurfr> is on a distinguished road

  Old

Originally Posted by jono1
....maybe you could actually say something? you know, so we can figure out what you're getting at?
Just wanted to post a variation on how to center content on a page.
From looking on the web the only one I found was the one using
javascript and CSS. The variation I made contains the meta tags
and the other info to markup as avalid by w3c with a file size of
968 bytes file size. Its just one variation. People get defensive with negative input but nobody posted another solution with CSS using
the margin:auto; attribute.

This is the HTML CSS section and if anyone did a search that was
looking to find an answer to this they would find this post with
different variations from the members suggestions.



_|

08-22-2005, 05:30 AM
#13
Julian is offline Julian
Status: Simply to simplify
Join date: Apr 2005
Location: Foxton, Manawatu, New Zealand
Expertise:
Software:
 
Posts: 5,572
iTrader: 0 / 0%
 

Julian is on a distinguished road

  Old

#wrapper {
position: relative;
width: 750px;
margin: 0 auto; /* compliant center */
text-align: left; /* override ie 5 center */
}

^^^ that's how I do it, width alters dependant on the page.

09-10-2005, 05:06 AM
#14
Xaxen is offline Xaxen
Status: I'm new around here
Join date: Sep 2005
Location: Calgary, AB
Expertise:
Software:
 
Posts: 24
iTrader: 0 / 0%
 

Xaxen is on a distinguished road

Send a message via MSN to Xaxen

  Old

This works great in Firefox, but not in IE. Just stays stuck to the left side. Any suggestions?

09-10-2005, 06:51 AM
#15
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

Aswell as the above, make sure you use:
body { text-align: center; }

09-10-2005, 09:47 PM
#16
mscwd is offline mscwd
Status: Junior Member
Join date: Sep 2005
Location:
Expertise:
Software:
 
Posts: 48
iTrader: 0 / 0%
 

mscwd is on a distinguished road

  Old

A quick css trick is to add margin: auto to a div. It will center it perfectly.

09-11-2005, 03:14 AM
#17
Koobi is offline Koobi
Koobi's Avatar
Status: Member
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 312
iTrader: 0 / 0%
 

Koobi is on a distinguished road

  Old

Originally Posted by mscwd
A quick css trick is to add margin: auto to a div. It will center it perfectly.

as far as i know, a certain version of IE doesn't recognize "auto" for margins that is probably why Salathe mentioned the text-align

Closed Thread  
Page 2 of 2 < 1 2


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed