Some of the nicest workflow features—such as using the Page Properties dialog box to define CSS style properties—still write the rules to the head of the existing document. In most cases, you will want to move those rules into an external style sheet. There are two approaches available to do this. The first option is to export any existing styles into a new external style sheet. The second option is to copy the style code into an existing external style sheet. If you have an existing external style sheet, you should copy the code into it manually using the second option I outline below. Don’t try to export into an existing style sheet, or you will overwrite the CSS code that is already in it.
In the Export Styles as CSS File dialog box, save what will be a CSS file as test2.css.
Note: The file name cannot be test.css because exporting CSS styles creates a new CSS file with the rules defined in the HTML document, replacing any CSS file with the same name. Any rules defined in the original CSS file would be lost.
<style> and the existing styles may or may not be visible indented underneath. This listing includes all of the styles included in the internal style sheet. Select <style> in the CSS Styles panel and click the Delete CSS Style icon in the bottom right of the panel (it looks like a trash can). Although the page suddenly looks ugly—and the style code has been removed from the head of csstestexport.htm—the class attributes are still written to the code where those classes were assigned. <style>, although you also still have the test.css style sheet. Note: If you followed the steps in option 1 above, the code will have already been moved to an external style sheet. So when you get to step four below, you won’t see the code to be copied. If you want to follow the steps below, try undoing a few times in Dreamweaver (Edit > Undo) to get the code back into the head of the csstest.htm file. Then, use the steps below to copy the CSS code into the existing external style sheet.
p {
font-family: Geneva, Arial, Helvetica, sans-serif;
color: #0000FF;
}
.hilite_text {
color: #003300;
background-color: #FFFF66;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
color: #333333;
}
.layer1 {
border: medium dashed #000000;
margin: 10px;
width: 250px;
padding: 10px;
position: relative;
left: 50px;
}
<style type=“text/css”> </style>
After using both workflows for migrating CSS rules from a document to an external style sheet, notice the test.css has all of the rules, and test2.css has all but one of the rules. In development, avoid this by using only one of the above workflows, then attaching external style sheets to new documents as you create them.
You have used the new UI elements in Dreamweaver 8 to create styles... and to figure out what you have created. You have also investigated some of the new display capabilities for style properties.
Now that you are familiar with the CSS tools and features in Dreamweaver 8, I recommend that you read Adrian Senior’s six-part tutorial on designing with CSS in Dreamweaver 8. Even if you have been through the Dreamweaver MX 2004 version of the article series, I recommend that you go through it again. They have been completely updated for Dreamweaver 8 and will help you get into good CSS workflow habits.