XHTML Help Please

liunx

Guest
I've finished converting a webpage from HTML 4.0 Trans to HTML 4.1 Strict to XHTML 1.0 Strict :cheers:.<br />
<br />
I don't know if it's something obvious I'm missing, but I can't seem to center the page in the browser frame! Everything I try in XHTML and CSS fails validation.:bash:<br />
<br />
(signed) I'm really :confused:!!!!!<!--content-->Where is the page URL?<br />
Which browsers does this happen on?<br />
<br />
Have you tried the CSS...<br />
text-decoration: center;<br />
it will work on more things than just text and should satisfy validation.<!--content-->I'll try that. Sorry, it's for a corporate intranet. If I showed you, I would then be expected to shoot you :ak47:.<br />
Thanks anyway!<!--content-->You're not using IE6, by any chance? If so, read this:<br />
<br />
<!-- m --><a class="postlink" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie60/html/cssenhancements.asp">http://msdn.microsoft.com/library/defau ... ements.asp</a><!-- m --><br />
<br />
under "Stricter Style Sheet Parsing".<br />
<br />
You now need to specify units (px, pt, etc.) in all CSS.<br />
<br />
<htmlite> : text-align<!--content-->Originally posted by _mrkite <br />
<htmlite> : text-align <br />
<br />
Man... my game is off these days. You are quite correct. My example should have read...<br />
<br />
text-align: center;<br />
<br />
Good eye _mrkite!<!--content-->How to center:<br />
<br />
"text-align: center" is for formatting text, not block level elements. Win IE incorrectly centers block elements. Mac IE doesn't do this.<br />
<br />
The correct way to center is to use margin: auto. This will work in Netscape 6. You won't be able to center for netscape 4 AND validate. Netscape 4 doesn't handle CSS.<br />
<br />
#centeredDivParent{<br />
text-align: center;/* IE hack */<br />
}<br />
#centeredDiv{<br />
margin: auto;<br />
text-align: left;/* don't want centered text */<br />
}<br />
<br />
Good luck<!--content-->
 
Back
Top