A.3. Chapter 3
A.3.1.
A.3.1.1.
A.3.1.1.1. Exercise 1 solution
The biggest benefit of an external style sheet is the fact that it can be applied to the entire site. Simply by changing a single rule in that file, you can influence all pages in your site that make use of that rule. With embedded or inline styles, you need to manually change all the files in your site. External style sheets also make it much easier to reuse a certain style with many different elements in your site. Simply create a class or an ID selector and reuse that wherever you see fit.
A.3.1.1.2. Exercise 2 solution
The rule can look like this:
h1
{
font-family: Arial;
color: Blue;
font-size: 18px;
border-top: 1px solid blue;
border-left: 1px solid blue;
}
Note another shorthand version of the border property. This one looks similar to the border property you saw earlier in this chapter that allowed you to set the size, style, and color of the border at once. In this rule, border-top and border-left are used to change the left and top borders only; the other two directions, the bottom and right border, are not affected by this rule.
A.3.1.1.3. Exercise 3 solution
The second declaration is more reusable in your site as it denotes a Class selector as opposed to an ID selector. The latter can only be used once in a single page by an element that has a matching id attribute: MainContent in this example. The Class selector BoxWithBorders, on the other hand, can be used by multiple elements in a single page, ...