Quote:
Originally Posted by Tex2002ans
Yes, you'll want to use the background-color CSS:
HTML:
Code:
<div class="red">
<p>This is going to have a red background.</p>
</div>
<p class="blue">This is a blue background too.</p>
CSS:
Code:
div.red {
background-color: red;
}
p.blue {
background-color: blue;
}
|
It's not neccesary to employ "background
-color"; just writting "background" will work because that it is a shorthand for background-color, background-image, background-size, background: position, background-repeat, etc.; it doesn't matter if one of the values are missing. So, "background: blue" it'll be a shorthand for "background-color: blue"; background: 100%, it'll be a shorthand for "background-size: 100%"; even you can use something like: "background: blue url("path_to_an_image")"; if the image is present, then the image will be showed, but if not, then the color blue will be displayed as background.