View Single Post
  #1 (permalink)  
Old December 28th, 2015, 01:08 AM
snowcrasher555 snowcrasher555 is offline
Registered User
Points: 45, Level: 1
Points: 45, Level: 1 Points: 45, Level: 1 Points: 45, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Dec 2015
Posts: 5
Thanks: 5
Thanked 2 Times in 2 Posts
Question Chapter 9 - Examples 4 and 5

First, there seems to be a typo or two for the Chapter 9 Example 4 at the very top of the HTML code, at least using the epub version for the 5th edition I purchased a few days ago:

In example 5, it also goes from using "new-style" to using "newStyle", I don't think it's intentional.

Second, I am having trouble understanding why Example 5 does not result in italicized text. When I inspected the source code using Firefox's developer tools, it seems there's some conflict with Arial and Italics when done in the way of Example 5, but not when you do it in the way of Example 4. My question is why this should be.

For reference, here is example 5 (and a link to the book's example):

HTML Code:
<html lang="en">
    <title>Chapter 9, Example 5</title>
        #divAdvert {
            font: 12pt arial;

        .new-style {
            font-style: italic;
            text-decoration: underline;

    <div id="divAdvert">
        Here is an advertisement.

        var divAdvert = document.getElementById("divAdvert");
        divAdvert.className = "new-style";

If I add
Code: = "italic";
, it does italicize.
Reply With Quote
The Following User Says Thank You to snowcrasher555 For This Useful Post:
Moby (January 3rd, 2016)