HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

Chapter 9


CSS: The Style Sheet


Contents


9.1 Why Bother With Style Sheets?......... 91
9.2 Style Sheet vs Inline Styling............ 92
9.3 background-color:.................. 92
9.4 color:.......................... 92
9.5 font-size:........................ 93
9.6 font-weight: (normal, bold)............ 93
9.7 font-style: (normal, italic)............. 94
9.8 text-align: (left, right, center, justify)...... 94
9.9 text-shadow: x y blur color............ 95
9.10 CSS Comments.................... 96
9.11 Review of Previous Chapters........... 96

In Chapter 1 (page 8) we used a small amount of styling. We styled a
background color to be yellow, and we styled an image to have a border.
As we further learned in section 4.4.1 (page 46), there is a globally available
attribute,style=, that can be applied to any HTML tag. It allows you to
apply styling directly to that element. It is called in-line styling.


Often we want to apply similar styling to many elements of the same kind.
Styling each one individually is tedious, and making changes later is truly
awful. We want a general solution.


Our more general solution is the style sheet.


90

Free download pdf