B.1. Creating StylesYou begin most CSS- related tasks in the CSS Styles panel, which is Dreamweaver's command center for creating styles. To open it, choose Window CSS Styles (or press Shift-F11). Using Figure B-1 as a guide, here's how to find your way around the CSS Styles panel:
Figure B-1. With the All button selected, the CSS Styles panel lists the names of all styles available to the current page, including external and internal style sheets. In this example, an internal style sheet contains a single style, and one external style sheetheadlines.csscontains seven styles.B.1.1. Phase 1: Set Up the CSS TypeTo create a new style, choose Text CSS Styles New. Or, on the CSS Styles panel, you can click the New Style button, or right-click anywhere in the panel and select New from the shortcut menu. The New CSS Rule dialog box appears (Figure B-2), where you begin creating your new style:
Tip: Class style names must begin with a letter, too, and can contain only letters and numbers . Dreamweaver lets you know if you use any invalid characters for the name. If you chose Tag instead, select the HTML tag you want to redefine from the Tag pop-up menu (which appears when you click the Tag radio button). Or, if you're an old hand at HTML, just type the tag name without the brackets. When you want to create a style for all unordered (bulleted) lists, type ul . If you clicked the Advanced button, Dreamweaver lets you type any valid CSS selector type, including plain old tag and class styles.
Tip: If you'll be using this style sheet for all of the pages in your site, then you may want to save it in the root folder of your site, or in a folder specifically dedicated to style sheets and give it a general name like site_styles.css or global.css . (You don't have to type the .css file name extension, by the way. In this case, Dreamweaver adds it.) Figure B-2. In the New CSS Rule dialog box, you choose a type of style and give it a name. The label next to the naming box changes depending on the type of style you choose. In this example, since Class is selected, the Name label appears. It changes to Tag if you click the Tag button, or Selector if you're using the Advanced option.No matter what "Define in" option you selected, clicking OK eventually brings you to the CSS Rule Definition window. B.1.2. Phase 2: Defining the StyleThe CSS Rule Definition window provides access to all of the formatting options available to you and your Web page text and graphics (Figure B-3). Here you can click to choose which properties to add to your style, instead of typing them. Look, mano spelling errors! Figure B-3. For ultimate formatting control, Dreamweaver lets you set 67 different Cascading Style Sheet properties from the CSS Rule Definition window. But it doesn't give you access to all the available CSS properties and, in some cases, Dreamweaver uses different names for CSS properties than are used in this book and in the CSS rules. Turn to Section B.1 for more details.Once you've defined the style, click OK at the bottom of the Rule Definition window. Dreamweaver adds the style to the specified style sheet, and displays it in the CSS Styles panel. |