CSS (Cascading Style Sheets) is a style sheet language for expressing how a document created in a markup language like HTML looks.
CSS is a stylesheet language that allows you to separate presentation from 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, reducing complexity and repetition in the structural content, and enable the.css file to be cached to improve page load speed between the pages that share the file and its formatting.
Selectors are used in CSS to target HTML components that we want to customize on our web pages. CSS selectors come in a range of shapes and sizes, providing for fine-grained precision when styling elements.
SELECTOR
The first portion of a CSS Rule is a CSS selector. It's a set of items and words that tells the browser which HTML elements should be chosen to have the CSS property values from the rule applied to them.
The subject of the selector refers to the element or items that are selected by the selector.
PSUEDO SELECTOR
Pseudo-classes are what they sound like.
A pseudo-class is used to define an element's particular status.
It can, for example, be used to:
When a user hovers their mouse over an element, it is styled.
Visited and unvisited links are styled differently.
When an element receives a lot of attention, it's time to style it.
Examples of Psuedo Classes include Dynamic Pseudo-classes i.e link, visited, hover, active and focus. Pseudo-classes for UI elements: enabled, disabled ,checked
Shorthand CSS properties
CSS shorthand properties allow you to set the values of numerous other CSS properties at the same time. You can save time and energy by writing more brief (and frequently more readable) style sheets by using a shorthand attribute.
Shorthand properties are defined in the CSS specification to gather together the definitions of similar properties that function on the same subject. For example, the CSS background property is a shortcut for background-color, background-image, background-repeat, and background-position. Similarly, the shorthand font may be used to specify the most common font-related characteristics, and the margin shorthand can be used to define the different margins around a box.
Edge cases are tricky.
Top comments (0)