O'Reilly logo

Learning PHP, MySQL, JavaScript, and CSS, 2nd Edition by Robin Nixon

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

Chapter 18 Answers

  1. To import one style sheet into another you use the @import directive, like this: @import url('styles.css');.

  2. To import a stylesheet into a document, you can use the HTML <link /> tag, like this: <link rel='stylesheet' type='text/css' href='styles.css' />.

  3. To directly embed a style into an element, use the style attribute, like this: <div style='color:blue;'>.

  4. The difference between a CSS ID and a CSS class is that an ID is applied to only a single element, whereas a class can be applied to many elements.

  5. In a CSS declaration, ID names are prefixed with a # character and class names with a . character, as in #myid and .myclass.

  6. In CSS the semicolon is used as a separator between declarations.

  7. To add a comment to a stylesheet, you enclose it between /* and */ opening and closing comment markers.

  8. In CSS you can match any element using the * universal selector.

  9. To select a group of different elements and/or element types in CSS, you place a comma between each element, ID, class, etc.

  10. To make one CSS declaration of a pair with equal precedence have greater precedence over the other one, you append the !important declaration to it, like this: p { color:#ff0000 !important; }.

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