Aug 01 2010

What is CSS? What are cascading style sheets?

Category: CSS


CSS is an acronym that stands for cascading style sheets. CSS files are typically saved externally and allow you to modify the appearance of entire web pages. It is basically a way to define certain HTML elements such as borders,
sizes, alignments, colors, and fonts in a single external file. Not only does CSS allow for better control and flexibility, it also reduces repetitive tags creating cleaner, streamlined code. Most modern browsers have support for CSS.

The cascade in CSS refers to the way that rules are added together and applied. Think of the cascade in the literal sense of a waterfall or a river. As a river flows from the mountains to the sea, it starts off as a tiny trickle, but as more water is added through tributaries, it becomes bigger and more powerful. Yet the water in that original trickle is still part of the whole – Getting Started with CSS

When implementing CSS it is important to remember that:

  • Styles cascade down: Your CSS file will interpret the HTML structure from top to bottom.
  • A style applied to the <body> of a web page will affect everything inside the page unless overridden.
  • Styles are cumulative: Most values are inherited.
  • Inherited styles can be overridden: When you want to treat something on the page differently, you can create more detailed style rules and apply them selectively.

The order of your style sheet shouldn’t matter. However, the cascade plays an important role when there‚Äôs a conflict between rules. As a basic principle, style rules that appear lower down in a style sheet or <style> block override any previous rules in the case of a direct conflict.

Tags: , , , , ,



Challenge this Answer and/or Discuss