+ 2
Colourful boxes!
How do you set specific colours using html?
5 Antworten
+ 3
"background-color" property defines a color for background. For example, below is the HTML code for green colored box.
<div style="background-color: green; height: 50px; width: 50px;"></div>
+ 3
You can use the background-color property in the style attribute, like this:
<p style = “background-color: red;”>Red background</p>
<p style = “background-color: green;”>Green background</p>
<p style = “background-color: blue;”>Blue background</p>
Hope it helps!
+ 2
<p id="a">test</p>
<p id="b">test</p>
<p id="c">test</p>
<style>
#a{
color:red;
}
#b{
color:green;
}
#c{
color: blue;
}
</style>
CSS selectors will be helpful in this types of case
+ 2
you can also use hexadecimal such as #86b3d3 in place of a color such as red, blue, green