Murach's JavaScript and DOM Scripting
A crash course in CSS

This chapter shows you how to use CSS to format an XHTML document. Once you finish it, you'll be ready to create web pages for JavaScript applications. You'll also be ready to learn how to use JavaScript to control the CSS. (If you already know how to use CSS, you can skip this chapter for now and come back to it if you encounter CSS code that you don’t understand later in this book.)

Chapter 5 A crash course in CSS
A web page and its CSS 170
The web page 170
The XHTML for the web page 172
The CSS for the web page 174
Basic skills for using CSS 178
Basic CSS syntax 178
How to include CSS in a web page 180
How to specify measurements and colors 182
How to code selectors 184
How to code selectors for tags, ids, and classes 184
How to code other types of XHTML selectors 186
How to code pseudo-class selectors 188
How the cascade rules work 190
How to work with text and lists 192
How to style fonts 192
How to format text 194
How to format lists 196
How to work with the box model 198
An introduction to the box model 198
A web page that illustrates the box model 200
How to set height, width, margins, and padding 202
How to set borders 204
How to set background colors and images 206
How to position elements 208
How to change the display type of an element 208
How to float elements 210
How to use absolute positioning 212
How to use relative positioning 214
How to float controls on a form 216




Murach's JavaScript and DOM Scripting

Learn more about this book

View the table of contents


More about the eBook



Our 100% Guarantee

First, try our books for 90 days. Then, if you aren't completely convinced that our books are the best ones you've ever used, you can return them for a prompt refund...no questions asked.