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,472
There are 2048 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

The difinitive CSS centering?

Thread title: The difinitive CSS centering?
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
10-04-2007, 03:47 PM
#1
TechnikCoding is offline TechnikCoding
Status: On Vacation
Join date: Sep 2007
Location:
Expertise:
Software:
 
Posts: 15
iTrader: 0 / 0%
 

TechnikCoding is on a distinguished road

  Old  The difinitive CSS centering?

Hey,

I come to you to pose a question that has definatly been asked many a time. What's the best way to center a div in CSS?

Normal instant response:
div {position:relative: top:0; margin:0 auto; width:Npx}

But is this always the best way of doing it? I've seen many other techniques each with thier own drawback. The drawback to this response is its not entirely browser compatible.

Other ways:
div {position:absolute; width:Npx; margin-left:-N/2px; left:50%;}

The second is completly browser safe, but in a browser smaller than N in width, the left gets cut off. Which is best. Due to me being a UK coder, i dont have an iphone yet, but i am sure i will have to re-invent some of my personal coding standards for it. /disucss?

     


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

  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