/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Can’t get background color to work

Hello,

I am constructing a basic website and am stuck on the background color. It appears that the background color only shows up behind and to the sides of the main <div> of the page. It is white everywhere else.

The HTTP is as follows:

[code]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>

<title>Project 0 Home</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<link href=”styles/reset.css” rel=”stylesheet” type=”text/css” />
<link href=”styles/base.css” rel=”stylesheet” type=”text/css” />
<link href=”styles/fonts.css” rel=”stylesheet” type=”text/css” />
<link href=”styles/0style.css” rel=”stylesheet” type=”text/css” />

</head>
<body>
<div id=”pageContainer”>
<div id=”pageTitle”>
<div id=”titleText”>
Project 0
</div>
</div>
<div id=”bannerImage”>
<!– image source: http://www.sxc.hu/photo/543788
used with permission–>
<img src=”banner.jpg” alt=”banner” />
</div>
<div id=”menu”>
<ul>
<li><a href=””>Link 1</a></li>
<li><a href=””>Link 2</a></li>
<li><a href=””>Link 3</a></li>
<li><a href=””>Link 4</a></li>
</ul>
</div>
<div id=”pageContent”>
Testing
</div>
<div id=”footer”></div>
</div>
</body>
</html>
[/code]

And the CSS:

[code]
body
{
background-color: #0000ff;
margin:0;
padding:0;
}

#pageContainer{
border: 1px solid;
margin: 40px auto;
padding: 0px;
width: 800px;
font-size: 1em;
}

#pageTitle{
float:left;
margin:0px;
padding:auto;
border-bottom: 1px solid;
border-right: 1px solid;
width: 299px;
height: 130px;
}

#titleText
{
font-family: courier;
font-size: 4em;
text-align: center;
position:relative;
top:30px;
}

#bannerImage{
margin: 0 0 0 299px;
padding:0;
}

#menu
{
padding: 0;
margin: 0;
width: 100%;
}

#menu ul
{
font-size: 1.0em;
height: 2.5em;
padding: 0;
margin: 0;
width: 100%;
}

#menu ul li
{
padding: .75em 0 .75em 0;
text-align: center;
float:left;
margin: 0;
width: 25%;
list-style: none;
}
#pageContent
{
margin:0;
padding:0;
border-top: 1px solid black;
}

#menu ul li:hover
{
background-color:#f00;
}

a:visited
{
text-decoration: none;
}
[/code]

Image of the webpage:

[url]http://img440.imageshack.us/img440/8715/websiteuo3.jpg[/url]

Can anyone identify the error?

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@CentauriJun 30.2008 — You have four css files linked, but we can only see one of them. This would look as though the html and body elements have differing styles applied, possibly the background - normally background styles applied to the body element propogate through to the html element unless separate backgrounds have been specified, in which case the body element acts just like any other block element such as a div.
Copy linkTweet thisAlerts:
@JforsythauthorJun 30.2008 — Thank you for the help.

The other 3 files are all part of the Yahoo UI library - we were required to link to them for the sake of my course.

Anyways, I looked through them and the <html> color and background attributes had been defined. I changed their values to none, and it worked.
×

Success!

Help @Jforsyth spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...