Tags
css
Asked 2 years ago
25 Apr 2022
Views 672
david

david posted

CSS background-color Property in HTML

how to use CSS background-color Property?
fatso

fatso
answered Apr 25 '22 00:00


<style>
.classall {
background-color: red;
}
</style>
<div class="classall">Hello i have red background color</div>


as you see above it set background color to red of the div by background-color property.
david

david
answered Apr 25 '22 00:00

The background-color property sets the background color of an element.

The background of an element is the total size of the element, including padding and border (but not the margin).

NOTE: background-color and color is different property , color property is used to set the color to the text, and when background-color is used to set the color of the element's background
Post Answer