• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

HTML Question. CSS problem.

ManBearPig

Diamond Member
When i link an external stylesheet and try to add a background color, it messes up and for some reason splits into parts. how can i add the background color in the stylesheet without it acting wierd?

thanks
 
well first of all, you have bgcolor specified in a couple of your td tags, so that will be static. Second, you need to show what your CSS looks like.
 
this is my style.css.

i know i have bgcolor in the page i linked, but i put it there because it wouldnt work when i took it out of style.css.

thanks alot!
 
First of all you shouldn't have any div tags outside the body tag, consider it the parent of the document. You can do the colour of the body in the css:

body
{
background-color:#447700;
}

And all will be fine.

If there was reason to have div tags outside your body tag (such as margin, padding etc of the body) those can be fixed too.

 
so i put </div></body> right? How exactly would i manipulate the margins and stuff?

and a questions about the body...is the "body" tag in the stylesheet the same as div.all? because she requires us to have a div.all. thanks alot man!
 
1. <html> is the ROOT element. It is the first, and EVERYTHING is inside it.
2. There are 2 children of <html>, the HEAD and BODY. There is NOTHING else.
<html>
<head>
some crap..
</head>
<body>
some crap..
</body>
</html>

DIVs cannot be placed outside of the BODY. Whoever told you this is right, is WRONG. It is much better to style BODY if you wish to apply a background color to the BODY.

body {
background: #470;
}

Will suit you fine. This is the simplest and best way to do it.

Here are a couple of other tips. I see that you have a link to an external stylesheet. I don't know why it's in UPPERCASE considering everything else isn't, but I'm guessing you copy pasted it. That's perfectly fine, but try keeping everything consistently sized.

Also, always have a DOCTYPE at the top of your HTML documents. It tells the browser what "rules" its conforming to. Try something like HTML 4.01 Strict, or HTML 4.01 Transitional.

Read about it here
 
Back
Top