Section 12.3. Defining General-Purpose Style Rules


12.3. Defining General-Purpose Style Rules

Occasionally, you may want to create a general-purpose style rule that applies to more than just one type of element. For instance, you might need a special strikethrough style that crosses out whatever text it happens to format, be it in a paragraph, a heading, or a list.

If so, create a class style, which can apply to any element. Here's how:

BEST BET

Create a class style whenever you want the style rule to apply to more than one type of element or HTML tag.


  1. In the CSS Styles panel, click the New CSS Rule button. You don't have to select anything in the document window first. Just click the button, and the New CSS Rule dialog box appears.

  2. Under Selector Type, choose Class, and type a brief but descriptive name for the style, like strikethrough or strikethru, as shown in Figure 12-12.

    Figure 12-12. Create a class style when you want the style rule to apply to any element

  3. Click OK. The New CSS Rule dialog box closes, and the CSS Rule Definition dialog box opens.

  4. In the Type category, under Decoration, check the option for line-through.

  5. Click OK. Dreamweaver adds the style rule to your external CSS file. Switch to its document window, and choose File Save. Then switch back to the document window for your template, but you dont have to save, because you didn't change anything in it. You simply modified the external CSS file.

  6. To apply this style, select some text in the document window by dragging the mouse across it. Then go to the Style menu on the Property Inspector, and choose your strikethrough style. Dreamweaver dutifully crosses out the text, as Figure 12-13 shows.

Figure 12-13. Applying the strikethrough class style to a string of text





Dreamweaver 8 Design and Construction
Dreamweaver 8 Design and Construction (OReilly Digital Studio)
ISBN: 0596101635
EAN: 2147483647
Year: N/A
Pages: 154
Authors: Marc Campbell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net