CSS Flashcards
What are the two parts of a CSS rule?
- Selector 2. Declaration
What are the two parts of a CSS declaration?
- property 2. value
How can you split design/CSS into two aspects/files?
layout (background, positioning) and appearance (fonts, colors)
What are the HTML tags to include CSS in the markup (not that you’d want to do this)?
style=”somestyle” allows you to include css styling on the element. allows you to write CSS in the html
What are the 8 types of CSS selectors?
- UNIVERSAL - * {} - selects every element in the markup
- TYPE - h1, div, p, etc. {} - selects every instance of the element type. You can select multiple types by separating them with a comma
- CLASS - .thisClass {} - selects every element which is a member of the class
- ID - #thisID {} - selects the element with the ID.
- CHILD - thing > thing2 - selects all the direct children of the thing (which could be a type, class, id, etc.)
- DESCENDENT - thing thing2 {} - selects all the thing2’s which descend (whether directly or indirectly) from thing.
- NEXT SIBLING - thing + thing2 {} - selects the thing’s next sibling thing2
- GENERAL SIBLING - thing ~ thing2 {} - selects all the siblings of thing which are thing2.
what are the cascading rules for CSS - priority of styling?
- styles further down in the file get priority over those above.
- SPECIFICITY - styles that are more specific get priority over those that are more general
- !IMPORTANT - you can override the first two priority rules by putting !important after the style (and within the semicolon)
Explain Inheritance
Elements inherit some styles but not others from their parent elements. You can hard code this by setting the property to “inherit”
What three things do you separate on a website
- Structure 2. Presentation 3. Behavior
What are four ways to specify color?
- BY NAME - for example “blue”
- BY HEX NUMBER - for example #ffffff
- BY RGB - for example rgb(33, 33, 33)
- BY HSL - for example hsl(300, 100%, 50%)
What is the default browser background color?
transparent, but the user can change that so it’s sometimes useful to set background color for the site
Define saturation, hue and brightness
SATURATION - the amount of grey in a color
HUE - the traditional understanding of color
BRIGHTNESS - the amount of black in a color
Explain the properties when setting a color using HSL
hsl(240, 100%, 50%, .8)
first parameter is the degrees on a color wheel from 0 - 360
second parameter is the amount of saturation from 0 - 100%
third parameter is degree of “lightness” or the amount of BOTH white and black in the color.
fourth parameter (which is optional) is the percentage of opacity described as a decimal
What are two types of text formatting?
- the kind of formatting which only affects the appearance of the font (i.e. bold, italic, font-family, etc.)
- the kind of formatting which positions the text within it’s container (i.e. line-height, kerning, etc.)
What are 5 types of fonts?
- Serif
- Sans-Serif
- Monospace
- Cursive
- Fantasy
What are the 5 parts of a font?
- Ascender - part of the font ascending above the line
- Cap height - height of the line
- X-height - height of the lowercase X
- Baseline
- Descender - part of the font descending below the line
What are three aspects of a font?
- Weight
- Style
- Stretch
What does specifying font-size by percentage do?
sets font size at a percentage of the browsers default font size (usually 16 pixels)
define “em”
the width of a letter “m”. used to set relative size