O'Reilly logo

JavaScript Testing by Liang Yuxian Eugene

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

Time for action—styling your HTML document using CSS

Now we are going to style the HTML document that we created in the preceding section, by using CSS. For simplicity, we'll use an internal CSS. What will happen in this section is that you will see the CSS syntax in action, and how it styles each HTML element by making use of the id attribute and class attribute of the respective HTML element. Note that both id and class selectors are used in this example.

Note

The completed version of this example can be found in the source code folder of Chapter 1, with the file name: chapter1-css-appearance.html

  1. Continuing from the previous example, open up your text editor and insert the following code after the</title> tag:
    <style type="text/css"> body{ background-color:#cccccc; ...

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