Anatomy of a Style Sheet

It is time for some more definitions. Figure 14.4 is a partial view of the CSS behind the default WordPress theme, Kubrick. Looking at style.css, you see something similar to a two-column table, with an object on the left side, some braces, and some settings on the right. The whole thing is called a rule. The object is called a selector, and the stuff inside the braces is a declaration. Each declaration has at least one property (like color, font, margin, or border) and a value (that you set the property to).

The first part of Figure 14.4 is a comment that browsers won't read. Comments are designated in CSS by the opening /* and the closing */ (notice that these two keys are at the top of the number pad on the right side of your standard keyboard).

This comment tells you, the human, something about the theme it describes. This is followed by another comment defining a Typography and Colors section of this site. The functional part of the style sheet follows, with rules for the body text. You might recall that the W3C Validator threw an error for using <font> tags on a website. Yet this first rule in the CSS file defines font-size and font-family. Is this a contradiction? A resounding "No!" comes from the standards crowd. "Font descriptions belong in CSS, and nowhere else!" The

C note

The generic Sans-Serif font is defined by your operating system. In Windows, the Microsoft Sans Serif font is the default; this setting is buried in the Registry under HKEY_LOCAL_MACHINE\ SOFTWARE\Microsoft\Windows NT\CurrentVersion\ FontSubstitutes\MS Shell Dlg. In Linux, the Sans-Serif default depends on your desktop environment. KDE uses Deja Vu Sans as a default, while GNOME uses just plain Sans. The Mac uses Helvetica and Geneva.

Instant Ways To Monetize Your Blog

Instant Ways To Monetize Your Blog

Get Paid For What You’re Worth. Benefit From Your Talent. Get Your Due Credit. Provide Your Skills A Platform To Shine. Enhance Your Opportunities. Learn how to monetize your blog and reap the rewards of your skills.

Get My Free Ebook


Post a comment