O'Reilly logo

Beginning CSS: Cascading Style Sheets for Web Design, Second Edition by Richard York

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Answers to Exercises

Q:

Style sheets are made of what?

A:

Rules.

Q:

What's the difference between when width: auto; is applied to a <table> as opposed to a <div> element?

A:

A <table> shrinks-to-fit, a <div> expands-to-fit.

Q:

Complete the sequence: Declaration, Property,__________________________________

A:

Value.

Q:

Convert the color RGB(234, 123, 45) to hexadecimal.

A:

#EA7B2D.

Q:

What is the shortened hexadecimal notation of #FFFFFF?

A:

#FFF

Q:

When does dithering occur?

A:

When one or more colors are not supported by the operating system or display device, the operating system will attempt to make the nonsupported color by using one or more colors it does support.

Q:

If I have a style sheet located at http://www.example.com/stylesheet.css, and a web page located at http://www.example.com/index.html, what markup would I include in index.html to include stylesheet.css via a relative path?

A:

<link rel="stylesheet" type="text/css" href="stylesheet.css" />

Q:

Does the selector body * apply to <input> elements (assuming an <input> element appears between the <body> and </body> tags)?

A:

Yes, the selector applies to all descendants of the <body> element.

Q:

In the following HTML document, do the selectors li a and li > a refer to the same element(s)? Can those selectors be used interchangeably? What type of selector is each? Which one is better to use and why?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtmll/DTD/xhtmll-strict.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required