+ 2

Colourful boxes!

How do you set specific colours using html?

20th Jun 2018, 6:15 PM
George
George - avatar
5 odpowiedzi
20th Jun 2018, 6:56 PM
Rtvq
Rtvq - avatar
+ 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>
20th Jun 2018, 7:15 PM
777
777 - avatar
+ 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!
21st Jun 2018, 8:58 AM
Rowsej
Rowsej - avatar
+ 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
20th Jun 2018, 6:46 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 2
you can also use hexadecimal such as #86b3d3 in place of a color such as red, blue, green
20th Jun 2018, 6:55 PM
Rtvq
Rtvq - avatar