Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Dreamweaver

  • Print
  • + Share This
  • 💬 Discuss
From the book Modifying an existing CSS layout

Modifying an existing CSS layout

The predefined CSS layouts provided by Dreamweaver are always a good starting point. They are easy to modify and adaptable 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.

  1. Choose File > New.
  2. Choose Blank Page > HTML in the New Page dialog box.
  3. Dreamweaver CS6 offers 16 standard HTML 4 layouts and two HTML5 CSS layouts. Although the HTML5 layouts use some of the new semantic content elements, they are nearly identical to the HTML 4 designs. Unless you need to support an installed base of older browsers, 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.

  4. Select HTML5: 2 column fixed, right sidebar, header and footer from the layout list. Click Open/Create.
  5. Switch to Design view, if necessary.
  6. Insert the cursor anywhere in the page content. Observe the names and order of the tag selectors at the bottom of the document window.
  7. 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 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.

  8. Choose View > Style Rendering > Display Styles to disable CSS styling in Design view.
  9. 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.

  10. Note the identity and order of each page component.
  11. 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 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.

  12. Choose View > Style Rendering > Display Styles to turn on CSS styling again.
  13. 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.

  14. 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.

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.

<header>...</header> 
<footer>...</footer>
<section>...</section> 
<article>...<article>
<nav>...</nav>

Instead, substitute a generic <div> element and use a class attribute that identifies the component:

<div class=”header”>...</div>
<div class=”footer”>...</div>
<div class=”section”>...</div>
<div class=”article”>...</div> 
<div class=”nav”>...</div>

You’ll also have to adapt the CSS styling for the HTML 4 elements. In most cases, Dreamweaver will supply many of the rules you’ll need with the layout or will build the appropriate selector name for you automatically by using the class name in place of the HTML5 component (header, footer, nav, and so on).

That way, the CSS rule header {color:#090} becomes instead .header { color: #090 }.

With all the caveats out of the way, the ugly truth is that even when you use standard HTML 4 code and components, older browsers and certain devices will still fail to render them properly. Some web designers believe that the longer we persist in using the older code, the longer the older software and devices will hang around making our lives difficult and delaying the inevitable adoption of HTML5. These designers say we should abandon the older standards and force users to upgrade as soon as possible.

The final decision is yours or your company’s to make. In most cases, the problems you experience with HTML5 will be minor flaws—a font that’s too big or too small—not a complete meltdown.

For more information about using whether you should use HTML 4 or HTML5, check out the following links:

http://tinyurl.com/html-differences

http://tinyurl.com/html-differences-2

http://tinyurl.com/html-differences-3

  • + Share This
  • 🔖 Save To Your Account

Discussions

comments powered by Disqus