Background Color
Changing the background color of divs
by Alan Jones
HTML
<div id="wrapper">
<div class="centreDivs" id="partA">
<p>
Wow! The main background is blue now!
</p>
</div>
<div class="centreDivs" id="partB">
<p>
Who's messing with my color switches?! What am I? Brown??
</p>
</div>
</div>
CSS
@import 'https://fonts.googleapis.com/css?family=Cantata+One|Jura';
#wrapper {
width: 100%;
margin: 0;
font-size: 1.3em;
padding: 40px 0;
background-color: #35d;
}
p {
text-align: center;
}
.centreDivs {
width: 60%;
background-color: #391;
padding: 10px 2%;
margin-bottom: 30px;
color: #fff;
}
#partA {
margin: 30px auto;
/* I added 30px to top and bottom margins to give clarity to the 2 divs*/
font-family: 'Cantata One', serif;
}
#partB {
margin: 0 18%;
font-family: 'Jura', sans-serif;
background-color: #672213;
}