michaellunsford Posted June 5, 2006 Share Posted June 5, 2006 This table is supposed to be centered. It's coming up left justified. I remove the doctype line and it works fine. What am I missing?[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><head></head><html><body><div style="margin-left:auto; margin-right:auto; width:765;"><table width="765" height="857" border="1" cellpadding="0" cellspacing="0"><tr><td width="765">hi there</td></tr></table></div></body></html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11261-help-auto-centering-not-working/ Share on other sites More sharing options...
michaellunsford Posted June 5, 2006 Author Share Posted June 5, 2006 nevermind...finally figured out that width requires px.765pxwhat a waste of two hours. Quote Link to comment https://forums.phpfreaks.com/topic/11261-help-auto-centering-not-working/#findComment-42136 Share on other sites More sharing options...
moberemk Posted June 5, 2006 Share Posted June 5, 2006 Just keep in mind that that doesn't work in IE6 and below. You'd need to also include a wrapper <div> that has text-align: center;. Quote Link to comment https://forums.phpfreaks.com/topic/11261-help-auto-centering-not-working/#findComment-42168 Share on other sites More sharing options...
wildteen88 Posted June 6, 2006 Share Posted June 6, 2006 [!--quoteo(post=380353:date=Jun 5 2006, 09:06 PM:name=moberemk)--][div class=\'quotetop\']QUOTE(moberemk @ Jun 5 2006, 09:06 PM) [snapback]380353[/snapback][/div][div class=\'quotemain\'][!--quotec--]Just keep in mind that that doesn't work in IE6 and below. You'd need to also include a wrapper <div> that has text-align: center;.[/quote]Actually it does as long as there is a valid doctype defined and that there is is width also defined for the element you are centering then your good to go, which michaellunsford has both of those! Quote Link to comment https://forums.phpfreaks.com/topic/11261-help-auto-centering-not-working/#findComment-42425 Share on other sites More sharing options...
moberemk Posted June 6, 2006 Share Posted June 6, 2006 Really? I'd always thought it didn't work like that. Learn something new every day, it seems. Quote Link to comment https://forums.phpfreaks.com/topic/11261-help-auto-centering-not-working/#findComment-42594 Share on other sites More sharing options...
michaellunsford Posted June 10, 2006 Author Share Posted June 10, 2006 Thanks for the dialog, guys. I am still learning the CSS ropes, and this kind of stuff certainly helps me know what to expect, and what to do if it happens.one thing that I really don't understand is the #wrapper thing. I have tried numerous examples that have the #wrapper tag, but removing it never seems to do anything.most of the examples are "html, body #wrapper". So, exactly what does the "wrapper" part do? Quote Link to comment https://forums.phpfreaks.com/topic/11261-help-auto-centering-not-working/#findComment-44022 Share on other sites More sharing options...
wildteen88 Posted June 10, 2006 Share Posted June 10, 2006 #wrapper is styling a html tag in your document that has an id of wrapper like this:[code]<div id="wrapper">somethiing here</div>[/code]Then in your css you can use this:[code]#wrapper { font-sixe: 20px; /*Change font size*/}[/code]With will change the font size of that div tag only.Usually web devs name a div tag the container or wrapper which holds all of the pages content, which then the developer uses css to center the site. Quote Link to comment https://forums.phpfreaks.com/topic/11261-help-auto-centering-not-working/#findComment-44035 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.