colors in HTML
Use of colors is indispensable in HTML. We have seen in the previous chapter that we are able to define the background or text color. But, how does one do this actually?
Here are two examples:
These are two different methods of the color definition, but both are leading to the same result.
You have got two possibilites to define a color in HTML:
- the RGB-value (hexadecimal, R = red, G = green, B = blue)
- name of the color
One should make sure, that if you choose the solution with the color name, there is only a restricted number of predefined colors. The value of the RGB-code is simpler there. But how does this work actually?
The hexadecimal-system has got 16 chars: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. The RGB-code consist of three parts: the share of red, green and blue. You can define him from 00 till FF.
The RGB-code starts with an #, so the browser knows, that there will follow an hexadecimal string.
For example the color red: #FF0000
or green: #00FF00
or blue: #0000FF
Well, we hope, that you have learnt something from our little introduction of the world of the HTML-tags. We wish you a lot of fun at building your own website.