Nepedia
Back to Discover
Fluent Reader
💻

CSS

technology Maturity 11-13 Next article →

CSS is a special language used to style web pages. It stands for Cascading Style Sheets. It works alongside HTML and JavaScript to build the internet. While HTML provides the basic content, CSS handles the presentation. This means it controls how things look on your screen.

W3C CSS Snapshot
W3C CSS Snapshot

CSS is a cornerstone of the World Wide Web. It allows for a separation of content and style. This separation makes web pages much easier to use. Content can be written without worrying about colors or fonts. It also helps people use different devices to read the web. Styles can change for screens, printed paper, or even voice readers.

How does CSS work step by step? It uses a list of rules called a style sheet. Each rule starts with a selector. A selector tells the computer which part of the page to change. It might pick all headers or one specific box. Next comes the declaration block, which is held inside curly braces. Inside this block, you find declarations. A declaration has a property and a value. For example, you might say the color is red.

Håkon Wium Lie
Håkon Wium Lie

You can use many different units for size. Some are absolute, like centimeters or inches. Others are relative, like pixels or percentages.

Before CSS, making a page look good was very hard. Authors had to put all the style code inside the HTML. They had to repeat the same code for every single heading. This made the files very large and hard to fix. If you wanted to change a color, you had to change it everywhere. CSS changed this by letting people use separate files. One small .css file can style many different pages at once. This makes the web faster and more consistent.

There are many ways to select parts of a page. You can use a class to style many items at once. You use a dot before the name to show a class. You can also use an ID for just one single item. An ID uses a hash prefix like a hashtag. Some selectors are even smart. A pseudo-class can change a style when you point a mouse at something. This is very useful for making buttons react to you.

W3C CSS Snapshot
W3C CSS Snapshot

The name "cascading" comes from how the computer picks styles. If there is more than one rule for one item, the computer follows a priority scheme. This scheme is predictable so designers can control the look. The rules for CSS are kept by the World Wide Web Consortium, or W3C. They even offer a free service to check if CSS code is correct. CSS is used in many places, including the GTK widget toolkit. It helps keep the digital world looking beautiful and organized.

453 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (3)
File:Håkon Wium Lie.jpg
Håkon Wium Lie.jpg
File:W3C CSS Snapshot.png
W3C CSS Snapshot.png
CSS Standardization - The State of the Web.webm
More to explore

✨ What else?

Related topics you might enjoy

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.