1. Introduction to Types of CSS

1.2. Inline CSS


          Inline CSS is incorporated as value of the style attribute of an HTML element. This is used to apply a unique style on an element as shown in the following code example and its output.

The code:


<!DOCTYPE html>
<html>
<body>
    <h3 style="color:blue;text-align:center;">This is header3.</h3>
    <h3 style="color:red;">This is another header 3.</h3>
</body>
</html>

The output:

          As you can see, the two <h3> elements will have a different style applied on each one. The first one will have blue colored text and centered on a line, while the second will have a red colored text and it is flushed to the left. You can also see in the code example, that there could be more than one CSS properties on an element that are separated with commas. If there would be several CSS properties to be applied on an HTML element, it is best to use the other two types of CSS as discussed next.