Read_Note

CSS

CSS consestes of two parts:

image

Using External CSS

how to link css page with html:

<link href="css/styles.css" type="text/css" rel="stylesheet" />


CSS Selectors

image

How Css Rules Cascade

LAST RULE If the two selectors are identical, the latter of the two will take precedence. Here you can see the second i selector takes precedence over the first.
SPECIFICITY If one selector is more specific than the others, the more specific rule will take precedence over more general ones.
In this example: h1 is more specific than *
p b is more specific than p
p#intro is more specific than p

Why use External Style Sheets?


color

You can chang color by many tools:

Background Color

Rgb values

These express colors in terms of how much red, green and blue are used to make it up. For example: rgb(100,100,90).

Hex codes

These are six-digit codes that represent the amount of red, green and blue in a color, preceded by a pound or hash # sign. For example: #ee3e80.

Color names

There are 147 predefined color names that are recognized by browsers. For example: DarkCyan.

HSL/a Color

The hsl color property has been introduced in CSS3 as an alternative way to specify colors. The value of the property starts with the letters hsl, followed by individual values inside parentheses for:
hue This is expressed as an angle (between 0 and 360 degrees).
saturation This is expressed as a percentage.
lightness This is expressed as a percentage with 0% being white, 50% being normal, and 100% being black.
alpha This is expressed as a number between 0 and 1.0. For example, 0.5 represents 50% transparency, and 0.75 represents 75% transparency.

Contrast

When picking foreground and background colors, it is important to ensure that there is enough contrast for the text to be legible.

Opacity

CSS3 introduces the opacity property which allows you to specify the opacity of an element and any of its child elements. The value is a number between 0.0 and 1.0 (so a value of 0.5 is 50% opacity and 0.15 is 15% opacity).