CSS
Our editors will review what you’ve submitted and determine whether to revise the article.
- In full:
- cascading style sheets
- Related Topics:
- computer programming language
- HTML
CSS, declarative-style computer programming language used to design website content. CSS is one of the three main languages used to design Web content, along with HTML (hypertext markup language) and JavaScript. HTML code gives websites their structure and content; JavaScript enables websites to be dynamic and interactive; and CSS is used for stylistic rendering of Web content. That is, CSS code controls how the many elements that make up a website appear to a user, including the page layout and the text font, size, and color. While CSS is used mainly to style HTML, it can also be used in combination with other markup languages, such as XML (extensible markup language).
Features
CSS code is composed of a series of rules, each consisting of a selector, which is used to identify which element of the markup language code is being styled, and one or more declarations. Each declaration consists of a property and a value. For instance, one rule that includes the selector “p” can be used to determine the styling applied to all paragraphs. The selector may be followed by a property to set text color (e.g., color: red) and a property to control text alignment (e.g., text-align: center). CSS is said to be “cascading” because the styling rules contained within CSS code cascade from one to the other in a hierarchical order, in which styling rules encoded higher up take precedence over rules lower in the code.
History
The invention of HTML by computer scientist Tim Berners-Lee in the early 1990s allowed content to be displayed on websites. However, HTML did not offer styling options. Prior to CSS, some style sheets existed, but they were built into their respective browsers and were proprietary to them. Moreover, the options provided by these style sheets were limited. For instance, the style sheet built into the Mosaic browser offered control only over certain colors and fonts.
CSS was first proposed in 1994, by Norwegian technologist Håkon Wium Lie, who was then working at the European Organization for Nuclear Research (CERN) with Berners-Lee. Two years later the World Wide Web Consortium (W3C) adopted the first standardized specifications for CSS, called CSS1. This version was developed jointly by Lie and Dutch programmer Bert Bos. Microsoft’s Internet Explorer became the first commercial browser to support CSS. In 1998 CSS2 was released, offering improved layout control and the ability to specify how content would appear on different platforms, including handheld devices, print, screen, television, and even Braille. CSS3, rolled out in 2011, added additional functionalities, such as responsive Web design and support for many new font types. It also introduced modules.
CSS modules are used to avoid style conflicts, because, on modules, application of CSS rules is local rather than global by default. Additionally, modules help users reuse code components, because each component can have its own set of stylistic rules. The introduction of modules improved CSS safety by having CSS rules apply locally rather than globally by default. In addition to the core development of CSS, the emergence of CSS frameworks, such as Bootstrap, has significantly simplified responsive Web design by providing reusable pre-styled components, such as navigation bars and buttons.