Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 771483 of CSS

  • Revision slug: Glossary/CSS
  • Revision title: CSS
  • Revision id: 771483
  • Created:
  • Creator: Andrew_Pfeiffer
  • Is current revision? No
  • Comment

Revision Content

CSS (cascading stylesheets) is a declarative language that controls how webpages look in the {{glossary("browser")}}. The browser applies CSS style declarations to selected elements to display them properly. A style declaration contains the properties, with their values, that determine how a webpage looks.

CSS is one of the three core Web technologies, along with {{Glossary("HTML")}} and {{Glossary("JavaScript")}}. CSS usually styles {{Glossary("Element","HTML elements")}}, but can be also used with other markups like {{Glossary("SVG")}} or {{Glossary("XML")}}.

A CSS rule is a set of {{Glossary("CSS Property","properties")}} associated with a {{Glossary("selector")}}. Here is a little example that makes every HTML paragraph yellow against a black background:

/* The selector "p" indicate that all paragraphs in the document will be affected by that rule */
p {
  /* The "color" property defines the text color, in this case yellow. */
  color: yellow;

  /* The "background-color" property defines the background color, in this case black. */
  background-color: black
}

"Cascading" refers to the rules that govern how {{Glossary("Selector", "selectors")}} are prioritized to change a page's appearance. This is a very important feature, since a complex website can have thousands of CSS rules.

Learn more

General knowledge

Technical reference

Learn about CSS

Revision Source

<p><strong>CSS </strong>(cascading stylesheets)&nbsp;is a declarative language that controls how webpages look in the {{glossary("browser")}}. The browser applies CSS style declarations to selected elements to display them properly. A style declaration contains the properties, with their values, that determine how a webpage looks.</p>

<p>CSS&nbsp;is one of the three core Web technologies, along with {{Glossary("HTML")}} and {{Glossary("JavaScript")}}. CSS usually styles {{Glossary("Element","HTML elements")}}, but can be also used with other markups like&nbsp;{{Glossary("SVG")}} or {{Glossary("XML")}}.</p>

<p>A CSS rule is a set of {{Glossary("CSS Property","properties")}} associated with a {{Glossary("selector")}}. Here is a little example that makes every HTML paragraph yellow against&nbsp;a black background:</p>

<pre class="brush: css">
/* The selector "p" indicate that all paragraphs in the document will be affected by that rule */
p {
  /* The "color" property defines the text color, in this case yellow. */
  color: yellow;

  /* The "background-color" property defines the background color, in this case black. */
  background-color: black
}</pre>

<p>"Cascading" refers to the rules that govern how&nbsp;{{Glossary("Selector", "selectors")}} are prioritized to change a page's appearance. This is a very important feature, since a complex website can have thousands of CSS rules.</p>

<h2 id="Learn_more">Learn more</h2>

<h3 id="General_knowledge">General knowledge</h3>

<ul>
 <li><a href="https://en.wikipedia.org/wiki/Cascading_Style_Sheets">CSS on Wikipedia</a></li>
</ul>

<h3 id="Technical_reference">Technical reference</h3>

<ul>
 <li><a href="/en-US/docs/Web/CSS">The CSS documentation on MDN</a></li>
 <li><a href="https://www.w3.org/Style/CSS/current-work" rel="external">The CSS Working Group current work</a></li>
</ul>

<h3 id="Learn_about_CSS">Learn about CSS</h3>

<ul>
 <li><a href="https://www.codecademy.com/en/tracks/web" rel="external">The web course on codecademy.com</a></li>
 <li><a href="https://www.expression-web-tutorial.com/Types_CSS_Styles.html">Three Types of CSS</a></li>
 <li><a href="https://pumpula.net/p/apps/css-vocabulary/" rel="external">The CSS Vocabulary</a></li>
</ul>
Revert to this revision