CSS (extra)
To style the documents. Source notes from CSS.adoc.
How CSS Works?
1. Convert HTML to DOM
2. Fetch resources in HTML (images, links, videos)
3. Browser parses CSS
4. Render tree laid out in structure
5. Page is displayed visually
Methods of applying CSS to a document
1. External stylesheet: External css file styling all HTML
documents. Reference using HTML <link> element.
2. Internal stylesheet: An internal stylesheet resides within an
HTML document. To create an internal stylesheet, you place CSS inside a
<style> element contained inside the HTML.
3. Inline styles (Avoid this): CSS declarations that affect a
single HTML element, contained within a style attribute
<h1 style="color: blue;background-color: yellow;border: 1px solid black;">
Hello World!
</h1>
Attributes/Properties
| Name | desc |
|---|---|
| @rules (at-rules) |
provide instruction for what CSS should perform or how it should
behave
|
| link / visited / hover |
styles unvisited links pink and visited links green; style when
the user hovers over it
|
| calc() |
do simple math within CSS:
|
| class |
To select a subset of the elements without changing the others,
you can add a class to your HTML element
|
| list-style-type |
To remove bullets from html doc
|
| selectors |
A CSS selector is the first part of a CSS Rule. It is a pattern of
elements and other terms that tell the browser which HTML elements
should be selected to have the CSS property values inside the rule
applied to them.
|
| shorthand |
font, background, padding, border, and margin are called shorthand
properties. This is because shorthand properties set several
values in a single line.
|
| transform() |
various values for transform, such as rotate()
|