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.

Was this article helpful?

0 0
Newbies Guide To Online Hobby Profits

Newbies Guide To Online Hobby Profits

Many people are passionate about their hobbies. They make time in their lives for them, spend lot of money on them, and even sometimes move their homes, families and jobs just to be closer to their hobbies. But even if you just enjoy your hobby and perhaps wouldn't class yourself as a fanatic, wouldn't it be great if you could earn money online possibly even a full-time income, from simply telling others people about your passion?

Get My Free Ebook

Post a comment