Reputation: 11
<body>
<div class="child-one">one<div>
<div class="child-two">two</div>
<div class="child-three">three</div>
</body>
body {
background-color: yellow;
font-family: 'Courier New', Courier, monospace;
}
.child-one {
background-color: rgb(206, 41, 41);
position: relative;
left: 20px;
}
.child-two {
background-color: white;
}
.child-three {
background-color: green;
}
On chrome, all three div elements are red but I cannot seem to find out why they are same color?
Upvotes: 0
Views: 156
Reputation: 197
You forgot the / in your ending tag
<body>
<div class="child-one">one<div> to </div> <------
<div class="child-two">two</div>
<div class="child-three">three</div>
</body>
body {
background-color: yellow;
font-family: 'Courier New', Courier, monospace;
}
.child-one {
background-color: rgb(206, 41, 41);
position: relative;
left: 20px;
}
.child-two {
background-color: white;
}
.child-three {
background-color: green;
}
<body>
<div class="child-one">one</div>
<div class="child-two">two</div>
<div class="child-three">three</div>
</body>
Upvotes: 1