TimeToCodeTheRoad
TimeToCodeTheRoad

Reputation: 7312

Background-color not working CSS in Class

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

Answers (3)

Momin
Momin

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

sansan
sansan

Reputation: 833

semicolon is missing before the background-color, Please correct it, Give semicolon to

margin-right: 1em;

Upvotes: 0

dfsq
dfsq

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

Related Questions