
Cascading Style Sheets (CSS) • 207
Of course, we can express this as an algorithm, as shown in Figure 5.14.
IF an inline stylesheet is defined
Use it
ELSE
IF an
internal stylesheet is defined
Use it
ELSE
IF an
external stylesheet is defined
Use it
ELSE
Use the browser’s default style
END-IF
END-IF
END-IF
Figure 5.14 Algorithm for deciding the type of stylesheet that needs to be applied
In short, the preference of applying a stylesheet in the order of the highest to the lowest is: inline ->
internal -> external -> browser default.
Now, because styles can repeat in these various types of stylesheets, they can cascade into each other.
Hence, ...