If HTML provides the structure of your website—like the foundation and framework of a house—CSS is what styles and decorates it, making it visually appealing and user-friendly. In this lesson, we’ll explore what CSS is, why it’s essential, and how it allows you to control the look and feel of your web pages.
By the end of this lesson, you'll be able to:
A long time ago, in a far away land (1994, Norway), websites were dull and boring because they didn’t have any “style.” At the time, computer text was mostly monotone and hard to read. The internet was slow, so hardly anyone used images, and there weren’t many common layouts to help users navigate websites. One day, CSS inventor Håkon Lie was lamenting this fact, wishing he could make the web look “more like a newspaper.” He wanted to give users the ability to style their HTML any way they wanted. “Perhaps they’d like to spice things up, add a little color...” Luckily, Håkon knew the right people. He worked at CERN with his friend Tim Berners-Lee, the original inventor of the World Wide Web. Håkon proposed that the internet would benefit from a single unifying standard for rendering text, color, and images across different web browsers. He called it “CSS” — aka, Cascading Style Sheets. Håkon worked with the web browser inventors, including Bert Bos and the World Wide Web Consortium, to implement CSS, which quickly became a great success! Today, CSS is used for a wide variety of tasks, including responsive web design, usability, and localization. It offers a scalable, versatile framework that simplifies the task of creating engaging, readable, and — yes — stylish online content.
CSS refers to Cascading. Style. Sheets. “Style sheets” refers to how CSS code is stored in — you guessed it — a sheet listing different style rules. These rules determine how your HTML content will be displayed by web browsers across different devices. The term “cascading” alludes to the way water falls down a waterfall. It was Håkon Lie’s (Remember him?) way of describing the logic of CSS, which falls gracefully through multiple sheets to ensure a consistent look and feel. You see, web browsers are not all the same — I know, you’re shocked! Some web browsers are older, some are pickier, and some are built for speed. CSS provides “cascading” logic so that your HTML style rules work the way you want, no matter which browser you use. CSS rules cascade, or “fall gracefully,” as web browsers implement them in a logical, hierarchical manner. For example, CSS lets you prioritize different rules for different screen sizes. You can also use CSS to design backup rules so that if some of your styles don’t work, your content will still be displayed as you intended.