Jump to content

HELP auto-centering not working


michaellunsford

Recommended Posts

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]
Link to comment
Share on other sites

[!--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!
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

#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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.