CSS
CSS
Answer: Some default from the browser (HTML tells what browser how)
body {
font-family: Tahoma, Arial, sans-serif;
Declaration color: black;
Block background: white;
margin: 8px;
}
Property Value
CS142 Lecture Notes - CSS 4
CSS Pseudo Selectors
hover - Apply rule when mouse is over element (e.g. tooltip)
p:hover, a:hover {
background-color: yellow;
}
a:link, a:visited - Apply rule when link has been visited or not visited (link)
a:visited { a:link {
color: green; color: blue;
} }
● Predefined names: red, blue, green, white, etc. (140 standard names)
● 8-bit hexadecimal numbers for red, green, blue: #ff0000
R G B
● 0-255 decimal intensities: rgb(255,255,0)
R G B
● Percentage intensities: rgb(80%,80%,100%)
R G B
Example: h1: { color: red; }
1mm millimeters
2cm centimeters
0.2in inches
Relative
2em 2 times the element’s current font size
● Composition is a problem
○ It can be really hard to figure out what rule from which stylesheet is messing things up