Itec106 02 Css
Itec106 02 Css
ITEC106
What is CSS?
• Cascading Style Sheet
• Håkon Wium Lie - He is best known for developing Cascading Style
Sheets (CSS) while working with Tim Berners-Lee and Robert Cailliau
at CERN in 1994.
• 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 or XML
• CSS describes how HTML elements are to be displayed on screen, or
in other media
What is Cascading?
The “cascading” in CSS refers to the fact that styling rules “cascade”
down from several sources. This means that CSS has an inherent
hierarchy and styles of a higher precedence will overwrite rules of a
lower precedence.
CSS Syntax/Rule
• The selector points to the HTML element you want to style.
• 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.
• Multiple CSS declarations are separated with semicolons, and
declaration blocks are surrounded by curly braces.
CSS Syntax/Rule
CSS Selectors
CSS selectors are used to "find" (or select) the HTML elements you
want to style.
• Simple selectors (select elements based on name, id, class)
• Combinator selectors (select elements based on a specific
relationship between them)
• Pseudo-class selectors (select elements based on a certain state)
• Pseudo-elements selectors (select and style a part of an element)
• Attribute selectors (select elements based on an attribute or attribute
value)
Simple selectors
Universal selector - also known as a wildcard—
matches any element.
Note: Inline style gets a specificity value of 1000, and is always given
the highest priority!
Note 2: There is one exception to this rule: if you use the !important
rule, it will even override inline styles!
Important links
• https://www.w3schools.com/cssref/css_selectors.php
• https://www.w3schools.com/css/css_specificity.asp
• https://www.w3schools.com/cssref/css_functions.php
CSS Reset
• https://andy-bell.co.uk/a-modern-css-reset/
CSS Mastery
• https://css-challenges.com/
• https://cssbattle.dev/