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. | 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. 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 Click OK. The New CSS Rule dialog box closes, and the CSS Rule Definition dialog box opens. In the Type category, under Decoration, check the option for line-through. 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. 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 |