Previewing Files and Modifying Existing CSS Layouts Using Adobe Dreamweaver CC
Note: This excerpt does not include the lesson files. The lesson files are available with purchase of the book.
To understand the layout you will work on in this lesson, preview the completed page in Dreamweaver.
- In Dreamweaver, press F8/Shift-Cmd-F to open the Files panel, and select DW-CC from the site list.
- In the Files panel, expand the Lesson04 folder.
- Double-click layout_finished.html to open it.
- Choose File > Close.
This page represents the completed layout you will create in this lesson. It is based on the wireframe drawings made earlier in this lesson and uses one of the new HTML5 CSS layouts available in Dreamweaver. Take a few moments to familiarize yourself with the design and components on the page. Can you determine what makes this layout different from existing HTML 4-based designs? You will learn the differences as you work through this lesson.
Modifying an existing CSS layout
The predefined CSS layouts provided by Dreamweaver are always a good starting point. They are easy to modify and adapt to most projects. Using a Dreamweaver CSS layout, you will create a proof-of-concept page to match the final wireframe design. This page will then be used to create the main project template in subsequent lessons. Let’s find the layout that best matches the wireframe.
- Choose File > New.
- Choose Blank Page > HTML in the New Document dialog box.
- Select HTML5: 2 column fixed, right sidebar, header and footer from the layout list. Click Open/Create.
- Switch to Design view, if necessary.
- Insert the cursor anywhere in the page content. Observe the names and order of the tag selectors at the bottom of the document window.
- Choose View > Style Rendering > Display Styles to disable CSS styling in Design view.
- Note the identity and order of each page component.
- Choose View > Style Rendering > Display Styles to turn on CSS styling again.
- Choose File > Save. In the Save As dialog box, navigate to the site root folder, if necessary. Name the file mylayout.html and click Save.
At the time of this writing, Dreamweaver CC offers two HTML5 CSS layouts. The exact number and features of these layouts may change over time through automatic updates via Creative Cloud. The changes to this list may occur without notice or fanfare, so keep your eyes peeled for new options in this dialog box.
The featured HTML5 layouts use some of the new semantic content elements and will help you get some experience with this evolving standard. Unless you need to support an installed base of older browsers (like IE5 and 6), there’s little to worry about using the newer layouts. Let’s choose one of the HTML5 layouts that best fits the needs of the new site.
The layout “HTML5: 2 column fixed, right sidebar, header and footer” has the most in common with the target design. The only difference is that the sidebar element is aligned to the right of the layout instead of to the left. You will align this element to the left later in this lesson.
The display order of elements in the tag selector directly correlates to the page’s code structure. Elements appearing to the left are parents, or containers, of all elements to the right. The element farthest to the left is the highest in the page structure. As you can see, the <body> element is highest and <div.container> is second.
As you click around the page sections, you will be able to determine the HTML structure without having to delve into the Code view window at all. In many ways, the tag selector interface makes the job of identifying the HTML skeleton much easier, especially in complex page designs.
The page consists of four main content elements, three subsections, and a single element that wraps around all the others. All but one of these are new HTML5 elements, including <header>, <footer>, <nav>, <aside>, <article>, and <section>. The only <div> elements in this layout are being used to hold the sidebar content and to hold everything together. Using these new elements means that you can apply complex CSS styling while reducing the complexity of the code overall. You can still use class and id attributes, but the new semantic elements reduce the need for this technique.
To understand exactly how much this design depends on CSS, it’s sometimes a good idea to shut off CSS styling.
Style display is typically on by default (showing a check mark in the menu). By clicking this option in the menu, you’ll toggle CSS styling off temporarily.
Without CSS, the HTML skeleton is exposed for all to see. It’s instructive to know what the page will look like if somehow the cascading style sheet is disabled or not supported by a particular browser. Now it’s easier to identify the page components and their structure. Although it is not strictly required, items that display higher on the page, like <header>, usually are inserted before other elements that appear lower, like <footer>.
Another important aspect you should notice is the navigation menu. Without the CSS styling, the navigation menu reverted back to a simple bulleted, or unordered, list with hyperlinks. Not too long ago this menu would have been built with tables, images, and complex rollover animation. If the images failed to load, the menu usually became a jumbled, unusable mess. The hyperlinks continued to work, but without the images there were no words to tell the user what they were clicking. But navigation built on text-based lists, on the other hand, will always be usable, even without styling.
It’s a good idea to get into the habit of saving files before you modify any settings or add content. Dreamweaver doesn’t offer a backup or recovered-file feature; if it crashes before you save, all your work in any open, unsaved file will be lost. Get into the habit of saving your files on a regular basis. It will prevent the loss of data and important changes to your files.
Dreamweaver normally saves HTML files to the default folder specified in the site definition, but it’s a good idea to double-check the destination to make sure your files end up in the right place. All HTML pages created for the final site will be saved in the site root folder.