bod1467 on Jun 2, 2010 at 2:11:44 AM (# 1) This message has been edited.Is this happening in all browsers? Which browsers are you testing with?
What DOCTYPE have you declared for the page?
Google is your friend bod1467 on Jun 2, 2010 at 6:19:48 AM (# 2)BTW - I meant to say ... it's nice to see an actual question here, rather than all the SPAM posts we seem to be getting. brian on Jun 2, 2010 at 7:12:29 AM (# 3) This message has been edited.If I recall correctly, if you use XHTML as the doctype you can simply set the width of the div and then set margin:auto as well, and it should center it. This AFAIK works on all browsers and really is a life saver.
This bit of code definitely works on IE and am certain it works just fine on other browsers too:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html> <head> <title>Untitled</title> </head>
<body> <div style="width:300px;margin:auto;border:1px solid black;">I'm centered</div>
</body> </html>
Also, as an added note, the XHTML doctype is only needed in IE and will not work in IE without it. Firefox definitely works either way. bikramrig on Jun 19, 2010 at 9:18:05 PM (# 4)Whats the difference between Absolute and Relative positioning ? Can you explain it by example, till date it is not very clear to me
WhyInsure Income Protection Insurance Australia bikramrig on Jun 19, 2010 at 9:20:32 PM (# 5)Relative means relative to what ? Thats my main question. Absolute means from what co ordinate ?
I need some example on relative and absolute positioning to understand the difference.
|