CSS

Cascading Style Sheets (CSS)
Icon for CSS3[1]
Example of CSS source code
Filename extension
.css
Internet media type
text/css
Uniform Type Identifier (UTI)public.css
Developed byWorld Wide Web Consortium (W3C)
Initial release17 December 1996; 27 years ago (1996-12-17)
Latest release
CSS 3 is being developed as multiple separate modules. Regular snapshots summarize their status.
7 December 2023; 11 months ago (2023-12-07)
Type of formatStyle sheet language
Container forStyle rules for HTML elements (tags)
Contained byHTML Documents
Open format?Yes
Websitew3.org/TR/CSS/#css

Cascading Style Sheets (CSS) is a style sheet language used for specifying the presentation and styling of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML).[2] CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.[3]

CSS is designed to enable the separation of content and presentation, including layout, colors, and fonts.[4] This separation can improve content accessibility, since the content can be written without concern for its presentation; provide more flexibility and control in the specification of presentation characteristics; enable multiple web pages to share formatting by specifying the relevant CSS in a separate .css file, which reduces complexity and repetition in the structural content; and enable the .css file to be cached to improve the page load speed between the pages that share the file and its formatting.

Separation of formatting and content also makes it feasible to present the same markup page in different styles for different rendering methods, such as on-screen, in print, by voice (via speech-based browser or screen reader), and on Braille-based tactile devices. CSS also has rules for alternate formatting if the content is accessed on a mobile device.[5]

The name cascading comes from the specified priority scheme to determine which declaration applies if more than one declaration of a property match a particular element. This cascading priority scheme is predictable.

The CSS specifications are maintained by the World Wide Web Consortium (W3C). Internet media type (MIME type) text/css is registered for use with CSS by RFC 2318 (March 1998). The W3C operates a free CSS validation service for CSS documents.[6]

In addition to HTML, other markup languages support the use of CSS including XHTML, plain XML, SVG, and XUL. CSS is also used in the GTK widget toolkit.

  1. ^ "W3C HTML5 Logo". W3C. Retrieved 20 November 2024.
  2. ^ "CSS developer guide". MDN Web Docs. Archived from the original on 2015-09-25. Retrieved 2015-09-24.
  3. ^ Flanagan, David (18 April 2011). JavaScript: the definitive guide. Beijing; Farnham: O'Reilly. p. 1. ISBN 978-1-4493-9385-4. OCLC 686709345. JavaScript is part of the triad of technologies that all Web developers must learn: HTML to specify the content of web pages, CSS to specify the presentation of web pages, and JavaScript to specify the behavior of web pages.
  4. ^ "What is CSS?". World Wide Web Consortium. Archived from the original on 2010-11-29. Retrieved 2010-12-01.
  5. ^ Clark, Scott (23 July 2010). "Web-based Mobile Apps of the Future Using HTML 5, CSS and JavaScript". HTML Goodies. HTMLGoodies. Archived from the original on 2014-10-20. Retrieved 2014-10-16.
  6. ^ "W3C CSS validation service". Archived from the original on 2011-02-14. Retrieved 2012-06-30.