Professional Documents
Culture Documents
1 Introduction
- The CSS1 specification was developed in 1996
http://jigsaw.w3.org/css-validator/
- Inline:
- Style sheet appears as the value of the style
attribute
- General form:
style = "property_1: value_1;
property_2: value_2;
…
property_n: value_n"
- Document-level:
2. Class Selectors
- For example,
- For example,
3. Generic Selectors
- Example,
.sale { … }
4. id Selectors
- General form:
#specific-id {property-value list}
- Example:
#section14 {...}
- Descendant Selectors
- Child Selectors
p:empty
for no children
7. Universal Selector
* {color: red;}
- Applies to all elements in the document
- URL values
- url(protocol://server/pathname)
- Colors
- Color name
- rgb(n1, n2, n3)
- Numbers can be decimal or percentages
- Hex form: #XXXXXX
- Font variants
- font-style
- font (shorthand)
- Text Spacing
- Unordered lists
- Bullet can be a disc (default), a square, or a
circle
- Example:
- 216 colors
- Use hex color values of 00, 33, 66, 99, CC,
and FF
- background-repeat property
- background-position property
<p>
Now is the <span> best time </span> ever!
</p>
...
<p>
Now is the
<span class = "bigred">
best time </span> ever!
</p>
- Sources of conflict:
- Resolution mechanisms:
a. id selectors
c. Contextual selectors
d. Universal selectors