CSS gives you the ability to define text (font) colors without hexadecimal values or RGB but only with color names. Currently there are 17 color names in CSS which are supported and validates against CSS validator. These are: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow Latest added color is orange.
Question: How to set color value in CSS? Answer: It's simple
Suppose you have a block of text. To begin defining color value at first put this text block in a div tag:
Then right after letter v in first div tag add the following line style="color:blue;" After that your code block should appear like this <div style="color:blue;"> Text block goes here </div> Preview webpage in your browser, text block should be blue. This method of adding colors to text isn't best because it's inline css, better practise is to put css code outside main page in separate stylesheet. But the syntax remains the same.
Bellow is a list of all 17 colors supported by css, you can see how your browser and monitor deals with colors. It's not images but blocks displayed with a support of CSS. Note that you can set color not only for text, but also for backgrounds and borders.
No comments:
Post a Comment