CSS

From WikiMD's Wellness Encyclopedia

Håkon Wium Lie
W3C CSS Snapshot

File:CSS Standardization - The State of the Web.webm Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.

Overview[edit | edit source]

CSS is designed to enable the separation of presentation and content, including layout, colors, and fonts. This separation can improve content accessibility, 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, and reduce complexity and repetition in the structural content.

Syntax[edit | edit source]

The CSS syntax consists of a set of rules. These rules are composed of selectors and a declaration block. A selector points to the HTML element you want to style, while the declaration block contains one or more declarations separated by semicolons. Each declaration includes a CSS property name and a value, separated by a colon.

Selectors[edit | edit source]

Selectors are patterns used to select the elements you want to style. There are several types of selectors in CSS:

  • Element selectors
  • ID selectors
  • Class selectors
  • Attribute selectors
  • Pseudo-class selectors
  • Pseudo-element selectors

Properties[edit | edit source]

CSS properties are the actual elements you wish to change. They could be color, font, width, height, background, and many more. Each property has a value that you assign to it, which dictates how it should look on the web page.

Inheritance and Cascade[edit | edit source]

Inheritance is a principle of CSS where some styles (like font-family or color) will be inherited by child elements from their parent elements. The cascade is a set of rules that defines how to resolve conflicts when multiple rules apply to an element. It takes into account specificity, importance, and source order.

Media Queries[edit | edit source]

Media queries allow the content rendering to adapt to conditions such as screen resolution (e.g., smartphone screen vs. computer screen). They are a key component of responsive web design, allowing developers to create web pages that work well on a variety of devices.

Frameworks and Preprocessors[edit | edit source]

CSS frameworks (like Bootstrap) and preprocessors (like Sass or LESS) are tools that can help streamline the process of writing CSS. They offer more functionality and syntactical sugar on top of standard CSS, such as variables, nested rules, and mixins.

History[edit | edit source]

CSS was first proposed by Håkon Wium Lie on October 10, 1994. At the time, the web was beginning to grow, but there was a clear need for web documents to be presented more attractively. The first CSS specification, CSS1, was released in 1996. Since then, CSS has gone through several versions, with CSS3 being split into modules and still under development to include more features.

Future of CSS[edit | edit source]

The future of CSS includes variables (custom properties), grid layout, flexbox, and more, which are designed to make layouts and designs more flexible and easier to manage. New features and improvements are continuously being worked on by the World Wide Web Consortium (W3C).

WikiMD
Navigation: Wellness - Encyclopedia - Health topics - Disease Index‏‎ - Drugs - World Directory - Gray's Anatomy - Keto diet - Recipes

Search WikiMD

Ad.Tired of being Overweight? Try W8MD's physician weight loss program.
Semaglutide (Ozempic / Wegovy and Tirzepatide (Mounjaro / Zepbound) available.
Advertise on WikiMD

WikiMD's Wellness Encyclopedia

Let Food Be Thy Medicine
Medicine Thy Food - Hippocrates

WikiMD is not a substitute for professional medical advice. See full disclaimer.
Credits:Most images are courtesy of Wikimedia commons, and templates Wikipedia, licensed under CC BY SA or similar.

Contributors: Prab R. Tumpati, MD