Reputation: 7312
I have the following CSS code. For some reason, the background-color is not working. can somebody pls help?
<!DOCTYPE HTML>
<!--Inform the Browser that the document is HTML-->
<html lang="en-US">
<head>
<meta charset="UTF-8">
<head>
<style type="text/css">
.leftpane{
width: 20%;
height: 80%;
border-color: brown;
border-width: .25em;
border-style: double;
float: left;
margin-right: 1em
background-color: orange;
}
</style>
<title>Trying CSS </title>
</head>
<body>
<div class="leftpane">
hi hi hi
<br/>
</div>
</body>
</html>
Upvotes: 1
Views: 72
Reputation: 3320
Try this using correct CSS syntax....
.leftpane {
width: 20%;
height: 80%;
border-color: brown;
border-width: .25em;
border-style: double;
float: left;
margin-right: 1em;
background-color: orange;
}
<div class="leftpane">
hi hi hi
<br/>
</div>
Upvotes: 0
Reputation: 833
semicolon is missing before the background-color, Please correct it, Give semicolon to
margin-right: 1em;
Upvotes: 0
Reputation: 193261
You forgot to put semicolon after previous rule:
margin-right: 1em /* <------ ooops! */
background-color: orange;
Lack of ;
makes parser ignore everything following after, so background-color: orange;
is never considered.
Upvotes: 3