27.02.2013 Views

Suitcase Fusion 3 User Guide for Mac OS - Extensis

Suitcase Fusion 3 User Guide for Mac OS - Extensis

Suitcase Fusion 3 User Guide for Mac OS - Extensis

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Classes<br />

When working with plain vanilla CSS, you will inevitably run into a situation where you want one or more<br />

elements on a page to differ stylistically from their default. For instance, you might want some paragraphs to<br />

appear in a script font.<br />

Not a problem, right? You can use an inline style sheet:<br />

Dear Diary, Today I fell in love!<br />

When you need to apply this to a few paragraphs, on a few pages, it isn’t too bad. What hurts is when you want<br />

to change the font from Comic Sans to something else. Then you have to go to each page and re-edit all the<br />

inline styles, then preview every page to make sure you didn’t miss any.<br />

This is why the CSS class was invented. In your web page, you can style the paragraphs using a class:<br />

Dear Diary, Today I fell in love with CSS all over<br />

again!<br />

The “hard work” is placed into your CSS:<br />

p.handwriting { font-family: "Comic Sans"; }<br />

handwriting is a class of the p selector, and is defined using the syntax selector.class. Now it is much<br />

easier to change out that Comic Sans <strong>for</strong> something more attractive; just change the class definition one time in<br />

your CSS.<br />

(This “dot syntax” is also common in programming: it shows the relationship between a main element and a<br />

specific “class” of that element.)<br />

A class can be specified independently of a selector, using the same syntax without the selector (note the “dot”<br />

at the beginning of the line):<br />

.handwriting { font-family: "Comic Sans"; }<br />

A class defined in this way is often called a class selector.<br />

This allows you to use the handwriting class in any element, or even on a single word:<br />

Diary Entries<br />

This section includes some excerpts from my journals, logs, and diaries.<br />

Anything you see in this style of text is an<br />

entry from one of my personal recollections.<br />

The above might look something like this:<br />

Diary Entries<br />

This section includes some excerpts from my journals, logs, and diaries. Anything you see in this style of text is an entry<br />

from one of my personal recollections.<br />

Notice that the class inherits the size specification of the parent or tag.<br />

You can also define a class differently <strong>for</strong> different selectors, as in:<br />

p.handwriting { font-family: "Comic Sans"; }<br />

h1.handwriting {font-family: "Times New Roman"; font-style: italic; }<br />

Finally, you can define the class independently of selectors, then redefine it <strong>for</strong> specific selectors:<br />

.handwriting { font-family: "Comic Sans"; }<br />

p.handwriting { color: #404040; }<br />

h1.handwriting { font-family: "Times New Roman"; font-style: italic; }<br />

The text will now appear in dark gray.<br />

- 80 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!