user3255328
user3255328

Reputation:

HTML: Why isn't this css file being used

I'm trying to use HTML and just call a CSS file which contains just a width and heaigh as well as colour for an object but it's not displaying the box.

HTML:

<head>
    <link rel="stylesheet" type="text/css" href="style.css"/>
    <title>Harry's Website</title>
</head>

<body>
    <div = id"navigation">
    </div>
    <div = id"header">
    </div>
    <div = id"contentleft">
    </div>
    <div = id"contentright">
    </div>
    <div = id"footer">
    </div>
</body>

CSS:

#navigation
{

    width: 100%;
    height: 35px;
    background-color: #000;

}

#header
{

    width: 100%;
    height: 35px;
    background-color: #000;

}

#contentleft
{

    width: 100%;
    height: 35px;
    background-color: #000;

}

#contentright
{

    width: 100%;
    height: 35px;
    background-color: #000;

}

#footer
{

    width: 100%;
    height: 35px;
    background-color: #000;

}

Upvotes: 1

Views: 59

Answers (4)

blurfus
blurfus

Reputation: 14031

Change this:

 <div = id"navigation">
 </div>

to this:

 <div id="navigation">
 </div>

Notice location of equal signs.

Upvotes: 2

lpoignant
lpoignant

Reputation: 106

Because your html is false try this :

<head>
    <link rel="stylesheet" type="text/css" href="style.css"/>
    <title>Harry's Website</title>
</head>

<body>
    <div id="navigation">
    </div>
    <div id="header">
    </div>
    <div id="contentleft">
    </div>
    <div id="contentright">
    </div>
    <div id="footer">
    </div>
</body>

Upvotes: 4

Josh Engelsma
Josh Engelsma

Reputation: 2646

Give an id using the HTML shown below

<body>
    <div id="navigation">
    </div>
    <div id="header">
    </div>
    <div id="contentleft">
    </div>
    <div id="contentright">
    </div>
    <div id="footer">
     </div>
</body>

Upvotes: 3

Cayde 6
Cayde 6

Reputation: 607

You may have the href path wrong, and you are missing the starting quote for all the id's

Upvotes: 1

Related Questions