There are two ways to set the background color of the Div, one is to set the background color directly within the DIV tag, and the external CSS setting div background color, to give you a detailed explanation of these two methods today.
First, set the background color directly inside the div tag
<div style= "background: #000; Color: #FFF "> Background is black </div>
Set the background color to black in the div tag and the font color to white
div Setting Background color
Set background color inside div tag
CSS styles such as background color are set using the style set in the div tag.
Second, external CSS set div background color
This is named ". Divcss5" for an object CSS, setting the div object background color by creating an external selector
CSS code:
. divcss5{background: #F00; color: #FFF} HTML Source code: <div class= "DIVCSS5" > Background color red </div>
The way to set the background color of the div is that these two kinds, the need for friends can be saved, but also please continue to follow the site of other updates.
Related reading:
Div+css How to use
What is CSS
html