CSS Flashcards
general syntax
selector {properties; }
ex. h2, p {color: blue;}
meaning of css
cascading style sheets
(more specific styles override more generic one)
browser > external > embedded > in-line > user-defined
embedded is part of an html document, in-line is part of an html element
units in css
relative length (em, rem, %, vw, vh, vmin, vmax)
absolute length (cm, mm, pt, px, in)
relative for screens; absolute for print
1 inch is 96px
selectors in css
- wild card *
- single (h1)
- group (h1, h2)
- class .class_name
- id #123
- attribute a[attribute=value]
class, and id are assigned to tags, attributes are part of tags
class ex. < img class=”img”>; id ex. < h2 id=”123”>
advanced selectors in css
- pseudo classes a:hover
- pseudo elements p::first-letter
- combinators
combinators are: descendant( ), child(>), adjacent/general sibling(+/~)
inheritance in css
font, color, list, and text styles are inherited
border/layout/margin/padding are not, unless specified
html boxes
from outermost to innermost box:
- margin
- border
- padding
- content
box border styling
border-style/color/width/radius/image
shortcut: border: 2px solid green; for width/style/color
box background styling
background-attachment/color/image/position/repeat/size
position property
absolute/relative/fixed/static
absolute is from the perimeter of the box, rel is from its normal spot
shortcut for centering in css
display: block;
margin: 0 auto;
float property
left/right/none
has clear and overflow properties
text styling
font-style/weight/variant/family/stretch/size
what is rwd
responsive web design
requires viewport in html: < meta name=”viewport”>
also in meta tag after viewport: content=”device-width, initial-width=1.0”>