Modifying HTML Tags

Sometimes, it's easier to modify an HTML tag than to create a brand-new class. For example, <b> is a lot easier to type than <span class="boldcopy">. In our example, we'll be using our original <h1>, <h2>, and <h3> tags. They look something like Example 8-7.

Example 8-7. Modifying HTML tags
h1 {
    font-size: 24px;
    font-weight: bold;
    color: #000000;
}

h2 {
    font-size: 20px;
    font-weight: bold;
    color: #000000;
    text-indent: 20;
}

h3 {
    font-size: 16px;
    font-weight: bold;
    color: #000000;
    text-indent: 40;
}

HOW THE CODE WORKS

Looks pretty similar to the classes we created earlier, doesn't it? It should—it's almost exactly the same. The only real difference is that we removed the period from the name of the tag and, of course, we ...

Get Advanced JavaScript™: Insights and Innovative Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.