<New code>
CSS
border: 1px solid red;
— applies a thin red border
CSS
background-color: red;
— makes something's background red
CSS
color: red;
— uses a named color to turn something red
CSS
color: rgb(255, 0, 0);
— specifies amounts of red,
green and blue to turn something red
CSS
color: #F00;
— uses a hexidecimal color to turn something red
CSS
color: #FF0000;
— uses a hexidecimal color to turn something red
CSS
opacity: 0.3;
— makes something 70% transparent
Resource
I like Quackit.com's CSS Color Codes
There are many ways to assign color to your pages
Code example
<!doctype html>
<html lang="en">
<head>
<style>
#borderID {border: 1px solid red;}
#backgroundID {background-color: red;}
#namedID {color: red;}
#rgbID {color: rgb(0, 255, 0);}
#shortHexID {color: #00F;}
#normalHexID {color: #0000FF;}
#opacityID {opacity: 0.3;}
</style>
</head>
<body>
<h2>CSS Color Example</h2>
<p>There are many ways to indicate color in CSS. You can...</p>
<ul>
<li id="borderID">give something a colored border</li>
<li id="backgroundID">give something a colored background</li>
<li id="namedID">use color names</li>
<li id="rgbID">use <code>rgb()</code> values from 0-255</li>
<li id="shortHexID">use short hexidecimal colors</li>
<li id="normalHexID">use normal hexidecimal colors</li>
<li id="opacityID">use opacity</li>
</ul>
</body>
</html>
Makes this:
Learn more
- Khan Academy on CSS basics
- w3schools.com on CSS3 colors