Week 4 Flashcards
What does CSS stand for?
Cascading Style Sheets
What is the style instruction that style sheets are made up of?
Rules or rule sets
What are the 2 parts of a rule?
- Selector
2. Declaration
What is a selector and what are the three types?
A selector is how you target something in your HTML to have style rules applied to it
- Element
- Class
- ID
(ex: h1 (selector) { colour: red; } (declaration))
What is a declaration?
A declaration is how you are defining the actual style rules to be applied, which is made up of a property/value pair
(ex: h1 { colour: (property) red; (value) }
What are the 3 ways that you can add styles to HTML documents through CSS?
- External style sheets
- Embedded style sheets
- Inline styles
What is an external style sheet?
- A separate text-only document containing all of your style rules
- Must be named with the .css extension
- The most powerful (and preferred) method of adding styles to a site
What is an embedded style sheet?
- Same style rules as an external style sheet but embedded in the of a single HTML document
- All embedded style rules must be wrapped in the element
What is an inline style sheet?
- You can apply rules to a singular element using the style attribute within the element itself
- Inline styles only apply to the element in which they directly appear
- Least preferred method
What is the style sheet hierarchy?
Inline styles OVERWRITE
Embedded styles OVERWRITE
External styles
Which two principles determine cascading priority?
- Last rule
2. Specificity
What is the last rule?
The latter of two selectors will take precedent
What is the specificity rule?
The most specific selector will take precedence over the more general one(s)
What are the three ways in which you can express colour in CSS?
- RGB Values - colours in terms of how much red, green and blue (eg: 100,100,90)
- Hex Codes - Six digit codes that represent the amount of red, green and blue in a colour proceeded by a hashtag (eg: #ee3e80)
- Colour Names - 147 predetermined colours recognized by browsers (eg: DarkCyan)
What is HSLA?
Hue, Saturation, Lightness and Alpha which determines opacity (optional)