Skip to Content
Beginning ASP.NET 3.5: In C# and VB
book

Beginning ASP.NET 3.5: In C# and VB

by Imar Spaanjaars
March 2008
Intermediate to advanced content levelIntermediate to advanced
766 pages
21h 15m
English
Wrox
Content preview from Beginning ASP.NET 3.5: In C# and VB

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, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ASP.NET 4: in C# and VB

Beginning ASP.NET 4: in C# and VB

Imar Spaanjaars
Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Bill Evjen, Scott Hanselman, Devin Rader

Publisher Resources

ISBN: 9780470187593Purchase book