The div selector makes this text red, since it is contained within a div tag.

The .blue selector makes this text blue, since it is contained within a span with a class "blue".

Note that this text, which is surrounded by a div block with the "blue" class, is blue since the .blue selector is analyzed last, so it takes precedence over the div selector. If the div selector and its declarations were placed after the .blue selector, then this text would be red. Try it!

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License