Unit 6 ยท Cascading Style Sheets (CSS)

6.1Introduction to CSS

What is CSS? CSS stands for Cascading Style Sheets. HTML gives a page its structure; CSS controls presentation: colours, fonts, spacing, layout and animation. Separating the two means you can restyle an entire website by changing one file.

Why "cascading"? Several rules can apply to the same element. The browser resolves conflicts using three factors, in this order: importance (!important), specificity (how precise the selector is), and source order (the later rule wins). Styles are also inherited: for example, color and font-family set on body pass down to child elements.