8 November 2010
A basic working knowledge of Adobe Dreamweaver.
Intermediate
This is Part 2 of a two-part tutorial series that demonstrates how to take a finished web page design, prepare it for export in Adobe Fireworks CS5, and then modify the HTML and CSS code in Adobe Dreamweaver CS5.
Part 1 covers exporting the design from Adobe Fireworks CS5.
In this part of the tutorial, you'll modify the exported CSS and HTML files in Dreamweaver to complete the design of the website.
If you completed the steps in Part 1, all of the files you exported from Fireworks were saved into a project folder. Before creating a new site in Dreamweaver, make sure that folder is located where you want it for example, in a folder with all of your other Dreamweaver sites . Alternatively, you can unzip the cheltenham_exported_css.zip sample file, which contains the three pages exported as CSS, HTML, and images ready to be modified in Dreamweaver.
To begin modifying the HTML and CSS in Dreamweaver, follow these steps:


After Dreamweaver creates the new site, you'll see the site name and all of the HTML and CSS files appear in the Files panel.
Remember that in Dreamweaver, Design view is a design environment for visual layout and editing, so it will not look exactly like the design as rendered in a browser. If you switch to Live view, however, you can see how a browser will display the page. Live view is powered by the WebKit browser engine. You can also choose File > Preview In Browser or press F12 to preview the page in your default browser. It's a good idea to preview your web pages in other browsers or use the Adobe BrowserLab to test pages in other browsers and on other platforms to ensure that they render correctly.
Take a moment and explore the exported code for index.html. All of the text is editable HTML. Bitmaps that were sliced in Fireworks appear as foreground and background images. You will also see that the object tags you applied in Fireworks are used to:
<h1> tag<div> structure to control the layout of the page for example, body_container , left_column , center_column , and right_column#center_column for <div> elements to ensure their content is properly positioned and styled.pullquote for styling the home page quotationYou will also see two vividly colored rectangles as placeholders for the navigation bar and the footer background image. Notice that the text links in the right column content modules and the footer appear only as plain text. They are not yet links, because in Part 1, you did not use separate text objects for each and designate them as links. If Part 1 had included a step that replaced the text with a Link component symbol or applied an <a> tag in the Property inspector, Fireworks would have exported links instead of plain text. You can, however, easily add the links from within Dreamweaver as well.
There are a few edits that must be made to finish this page:
Adding the footer background is simple, since you already exported the background image in Part 1. When Dreamweaver opens an HTML file, it also opens all of the associated files. Near the top-left corner of the Dreamweaver window you will see a tab for index.html, and below that are two files: Source Code the HTML file and index.css the CSS file .
#footer .In the style settings for the footer you will see:
background-color: #9ef6ff;This is the vivid background color fill you applied to make it noticeable.
background-image: url images/footer_bkgd.jpg ;This will change the background from a vivid fill color to the footer background image you exported and saved in the images folder.
Next, you'll remove the redundant text over the banners in the content modules in the right column see Figure 3 . You can simply delete the text from the HTML, but this may adversely affect search engine optimization SEO since you are deleting meaningful text. Alternatively, you can hide the text by moving it off the page. This preserves the text for SEO, but requires a little more editing.

Follow these steps to use the first approach and simply delete the text:
<div> named right_column .<div> , find the following lines and delete them:<div class="vol_module_label">
<p class="lastNode">Become a Volunteer Tutor!</p>
</div>
<div class="sched_module_label">
<p class="lastNode">Tutoring & Meeting Schedule</p>
</div>
.vol_module_label and .sched_module_label classes from the CSS file, because you are no longer using them.To use the SEO-friendly approach, follow these steps to hide the banner text:
.hide {
margin-left: -4000px;
}
This will move the text 4000 pixels to the left, far off the edge of the browser. The text won't be seen, but it will still be available to be indexed by search engines.
<div> named right_column .<div> elements: <div class="vol_module_label"> and <div class="sched_module_label">.hide to each of the classes as follows: <div class="vol_module_label hide"> and <div class="sched_module_label hide"> .This tells browsers to apply the negative left margin defined by the .hide class, which will preserve the layout of the content modules yet still hide the text out of view.

The links on the page that were exported as plain text need to be converted to hyperlinks and then styled to match the visual design:

Since the index.css file includes no styling information for links, when you refresh Design view all of the links will become blue–the default style for links in most browsers (see Figure 5). Fortunately, you defined the link styles using the HTML component symbols on the volunteer page in Fireworks, so rather than manually adding all of the link styles to index.css you can copy the styles from the volunteer.css file and modify them as needed.
#link styles:#Link:link, #Link:visited {
margin-left: 10px;
margin-top: 18px;
display: inline;
float: left;
margin-bottom: 0;
color: #595043;
font-family: Arial, Helvetica, sans-serif;
font-size: 120%;
font-weight: normal;
text-decoration: underline;
}
#Link:visited {
color: #393f66;
font-weight: normal;
text-decoration: underline;
}
#Link:hover, #Link:focus {
color: #c4870c;
font-weight: normal;
text-decoration: none;
}
#Link:active {
color: #c4870c;
font-weight: normal;
text-decoration: underline;
}
html > body #body_container {
height: auto;
min-height: 470px;
}
(This should be somewhere around line 94 in the index.css file.)
a:link {
color: #595043;
font-weight: normal;
text-decoration: underline;
}
a:visited {
color: #393f66;
font-weight: normal;
text-decoration: underline;
}
a:hover, a:focus {
color: #c4870c;
font-weight: normal;
text-decoration: none;
}
a:active {
color: #c4870c;
font-weight: normal;
text-decoration: underline;
}
In the edited code, you'll notice that the font family, positioning, margin, and padding information has been removed. Only the color, weight, and decoration information has been retained. The positioning, margin, and padding information are already specified for all of the text on the index.html page, so only the visual style information is needed for text links.
You'll also see that #Link was changed to just a (for example, #Link:link is now a:link ). This enables you to apply the styles directly to the <a> tag rather than creating a CSS ID for each link on the site. If you look at the code in the volunteer.css file, you will see that there are style definitions for each individual link on the page ( #Link , #Link2 , #Link3 , and so on). However, all of these link styles are the same (and differ only in the margin values, which are used for positioning each link), so using multiple CSS IDs is redundant and unnecessary. It is more efficient to define link styles for the <a> tag or to create a style class for links, so you can define the link styles once and use them for all text links.
All of the links on the page will change from default blue to the colors defined by the new additions to the CSS file. Also, since you only retained the portions of the CSS that pertain to visual appearance, the layout of the page has not been affected (see Figure 6).

The final step on the main page is to insert the Spry Menu Bar for the site navigation. In the original Fireworks file you turned off the visibility of the navigation and created a placeholder <div> to reserve room for the Spry Menu Bar. Follow these steps to insert it:
<div> :<div id="Nav_Placeholder"> </div><div> tags and choose Insert > Spry > Spry Menu Bar.Dreamweaver will insert a block of code within the <div> that you'll need to edit to specify the correct navigation structure for the site and to reflect the visual design. With the Spry Menu Bar selected, the Property inspector makes it easy to define the navigation links. For this website, the navigation structure has two levels (see Table 1).
Table 1. The Spry Menu Bar structure for the Cheltenham Academics website.
| Primary navigation | Secondary navigation |
|---|---|
| Volunteer as a Tutor | (no second-level navigation) |
| Teachers | (no second-level navigation) |
| Parents | (no second-level navigation) |
| Students | (no second-level navigation) |
| Calendar | (no second-level navigation) |
| Resources | (no second-level navigation) |
| About Us | Our History |
| The Volunteers | |
| The Board |
The left column of labels in the Property inspector corresponds to the primary navigation, the middle column is the secondary navigation (nested below the selected primary navigation item), and the right column is the tertiary navigation (nested below the selected secondary navigation), but the third column will remain blank for this site.
Complete instructions for customizing the visual presentation of the Spry Menu Bar are beyond the scope of this article. However, you can click Customize This Widget in the Property inspector to access help on how to change the appearance of the menu bar. Additionally, there are many excellent resources for using the Spry framework on the Spry home page.
The home page (index.html) is nearly complete, but the volunteer and calendar pages need a few changes before they reflect the visual design. You'll need to apply the same techniques you used on the main page to add the footer background image, hide (or delete) the content module banner text, add text links and their styles, and add a Spry Menu Bar to the volunteer and calendar pages.
With those changes done, there are just a few more updates left to make.
On the volunteer page in the left column under the header "Your Responsibilities as a Volunteer Tutor" there is a list of qualifications. If you look at the code of the volunteer.html page, you will see that this bullet list is not a real unordered list defined with the <ul> tag, but rather it is three rows of text preceded by the • character and separated by line breaks (that is, <br /> ).
Follow these steps to convert this to a true unordered list and style the Qualifications label as bold:
Note: When you edit text styles in Dreamweaver, you can either add style information to the HTML file or to the CSS file. Select the HTML option in the Property inspector when you want to add text style information to the HTML file and only to the selected text. Select the CSS option when you want to add text style information to the CSS class or ID of the currently selected text object, but be aware that modifying a class in the CSS file may change the appearance of text elsewhere on the page or site if that text shares the same CSS class.
<br /> tags and • characters.<li> tag and wrap all three in a <ul> tag.The edited code should look like this:
<p><strong>Qualifications:</strong></p>
<ul>
<li>Prior teacher certification and experience preferred.</li>
<li>Area of expertise in education preferred.</li>
<li>Patience and a willingness to provide encouragement.</li>
</ul>
This bullet list was exported from Fireworks as a simulated unordered list using the • character because Part 1 did not include a step to replace the list items with a List Item component symbol on the page in the original design file. Had List Item symbols been used, the HTML code and CSS styles for an unordered list would have been exported, and you would have edited the CSS to define the bullet type. By default, Fireworks exports unordered lists with no bullets.
The volunteer page should now look more like the original design (see Figure 7).
The calendar page content in the left column has three topics: Student Tutoring, Monthly Tutor Logs, and Advisory Board Meetings. These topics appear as subheaders followed by indented text in the visual design, but Fireworks has exported left-aligned plain text. These three sections would be best displayed by using a definition list with <dl> , <dt> , and <dd> elements.
Follow these steps to update the HTML:
<p>Student Tutoring<br /> Monday through Thursday after school. Other<br /> times can be arranged by request. If you need<br /> to arrange tutoring at a different time, please<br /> contact the tutoring coordinator.</p><p>Monthly Tutor Logs<br /> Volunteer tutors submit tutoring logs every<br /> month to help track student progress. Tutors <br /> also have regular communication with the<br /> volunteer coordinator and school staff.</p><p class="lastNode">Advisory Board Meetings<br /> The Cheltenham Academics Advisory Board<br /> meets regularly during the school year. Board<br /> meeting agendas are shared with members<br /> prior to each meeting, and meeting minutes<br /> are available upon request.</p>
<dl>
<dt>Student Tutoring</dt>
<dd>Monday through Thursday after school. Other times can be arranged by request. If you need to arrange tutoring at a different time, please contact the tutoring coordinator.</dd>
<dt>Monthly Tutor Logs</dt>
<dd>Volunteer tutors submit tutoring logs every month to help track student progress. Tutors also have regular communication with the volunteer coordinator and school staff.</dd>
<dt>Advisory Board Meetings</dt>
<dd>The Cheltenham Academics Advisory Board meets regularly during the school year. Board meeting agendas are shared with members prior to each meeting, and meeting minutes are available upon request.</dd>
</dl>
Now you're ready to apply styles this definition list to make it look more like the visual design.
dt {
font-weight: bold;
font-size: 16px;
color: #393f3f;
}
dd {
padding-bottom: 10px;
}
Note: The sequence of tag styles, classes, and IDs in the CSS file is important because it determines how the style rules are applied when conflicts or multiple styles for the same objects exist. For more information on how to sequences styles in a CSS file see the resources listed at the end of this tutorial.
These definition list styles will make the subheader (the definition term) bold and add some additional space after each block of text (the definition description.)
The calendar page also has two content modules for the tutoring schedules at the two schools. In the original design, the days and times are bold with larger text and the email address is a link. Since Fireworks exports text styled only like the first character of the text object, you'll need to modify the text styles in the modules, add some CSS style information, and add an email link:
.Txt_Monday class.120% and delete font-weight: bold; to make the text look like standard content text.<p> tag for that text.
<p> tag, select the times CSS style class from the Class selector in the Property inspector.Since the text in the two content modules share the same styles, you can simplify the CSS exported by Fireworks and use the same CSS class for the text in both. Remember that Fireworks exports CSS styles for each separate text object in the original design files, so in the calendar.css file you will see classes for Txt_Monday and Txt_Monday2 with duplicate style attributes.
<div class="Txt_Monday2"> and delete the 2 so that it becomes <div class="Txt_Monday"> . You may now delete the Txt_Monday2 class from the CSS file since it is no longer in use.<p> tag for the day and time text in the Cheltenham school module and select the times class in the Property inspector.The links will take on the default HTML link styles (see Figure 11), so you'll need to add the link styles you defined for the index.html page in index.css to the calendar.css file.
As a last step on the calendar page, you need to replace the embedded calendar image with the actual calendar code:
<div class= " clearFloat " > tags.<div> tags), insert the embedding code for the Google calendar:<iframe src="http://www.google.com/calendar/embed?title=Cheltenham%20Academics&height=460&wkst=1&bgcolor=%23FFFFFF&src=usa__en%40holiday.calendar.google.com&color=%236E6E41&ctz=America%2FNew_York" width="610" height="460" scrolling="no" frameborder="0" style=" border-width:0;">
</iframe>
Note: If you have your own Google calendar, you can get the embed code for it by going to your calendar settings, selecting the calendar you want to share, and getting the code from the Embed This Calendar option on the calendar details settings page.
You'll need to make one edit to the code to position the calendar properly. The deleted image had a 10 px left margin so that it would properly align with the content modules above it. To add that left margin to the embedded calendar, you could create another style in the CSS, or you could modify the inline style Google inserted in the <iframe> tag for the calendar. Since this is the only instance of the calendar on the website, a small edit to the inline style for the <iframe> will work.
<iframe> code that you just inserted, add the left margin value so that the inline style becomes:style=" border-width:0; margin-left:10px;"
The definition list, the bold day and time text, the email links, and the embedded calendar should all be in place, and the page should look much more like the original design (see Figure 12).
You can save a great deal of time using the Fireworks CSS export feature on prepared design files to quickly create web pages that are easy to modify in Dreamweaver. However, having separate HTML and CSS files for each page is not efficient. Most websites have many pages, and these pages usually share similar page structures (or layouts) and have shared CSS styles and assets. The underlying page structures are independent of the content and can be easily seen by looking at the <div> structure. For example, the home page has three columns in the main content area, and the volunteer page has two columns in the main content area. It is likely that there are other pages in the site where the content is well suited for display in two or three columns, so these page layouts could be reused again and again only with different content for each page.
Dreamweaver makes it easy to reuse page layouts with templates. You can use the original design file in Fireworks to set up the pages to become templates in Dreamweaver simply by defining the <div> structure with rectangles and hiding or deleting any text or images that will not be on every instance of that page template.
If you open the Cheltenham_templates.fw.jpg sample file in Fireworks you'll find two template pages (two column and three column layouts) based on the original designs. All of the text and images in the main content area have been deleted, and there are rectangles in the div layer that define the different regions of the page. Notice that the navigation bar and footer have placeholder rectangles, because you still need to modify the exported files in Dreamweaver to add the footer background image and the Spry Menu Bar before you turn them into templates.
The third page has a single large content area with two temporary rectangles subdividing it. The temporary rectangles contain the sitewide text styles, the PDF icon, and the background image for a generic content module (see Figure 13). The text objects, which use HTML component symbols and normal text objects, define the key CSS text styles that are used throughout the site on many pages, and the content module is the same size as the modules that appear on the home page and calendar page. You can export the generic content module using the three-slice technique, and turn the code for the module into a Dreamweaver library item. Library items are snippets of code that are reused multiple times throughout a site. They save time and effort because they can be inserted into a page from the Library, and when you edit a library item, Dreamweaver will automatically update all of the instances through the entire site.
Follow these steps to familiarize yourself with the file and create a library item:
<div> elements to see how they define the page layout.These files require some modification before they can be saved as Dreamweaver templates. Specifically, you'll need to do the following:
Detailed instructions for creating templates in Dreamweaver are beyond the scope of this article. For more information on creating templates see the Dreamweaver Developer Center.
The text objects, generic content module, and PDF icon were all exported with this page. If you look back at that HTML code for the volunteer page, you will see that Fireworks exported a separate image for each instance of the PDF icon. Multiple instances are unnecessary. Instead, you can include one version of the icon on a styles and objects page (such as this one) and reuse the image as many times as needed throughout the site.
Before you convert the content module into a library item for the site, you need to make a few modifications to the HTML and CSS first.
This is a generic content module, and it has no header text in the banner at the top of the module. To have the HTML text appear over the banner you'll need to edit the CSS.
#content_module_top {
margin-left: 0px;
margin-top: 0px;
background-image: url(images/module_top.png);
overflow: hidden;
display: inline;
float: left;
height: 52px;
margin-bottom: 0;
width: 290px;
}
#content_module_top {
height: 52px;
width: 290px;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0;
padding-top: 18px;
padding-left: 20px;
background-repeat: no-repeat;
background-attachment: scroll;
background-position: left top;
background-image: url(images/module_top.png);
overflow: hidden;
display: inline;
float: left;
font-family: Times New Roman, Times, serif;
font-size: 18px;
font-weight: bold;
text-align: left;
}
These changes to the CSS add padding, font, and alignment information so that the banner text appears in the correct location.
Note: Previously you hid or deleted the text that Fireworks exported for the banner header, because the text had been flattened into the image. This is a third alternative to handling text for the banner header.
<div id="content_module">
<div id="content_module_top">Banner title appears here</div>
<div class="module_text">
<p class="lastNode">Content module text appears here. </p>
</div>
<div class="clearFloat"></div>
<div id="content_module_bottom"></div>
</div>
<div class="clearFloat"></div>
Dreamweaver will warn you that the library item may not look the same when it is inserted into a web page, because the style information is not copied with it. This is normal, because the style information for the module will be in the consolidated CSS file used for the entire site.
To learn more see Managing Assets and Libraries in the Dreamweaver documentation.
To finish preparing the styles and objects page and create a generic page template you'll need to complete the steps outlined here:
This generic template has no column structure in the content area, so it can be used as the basis for pages that have special or unique content and layout by adding new <div> elements where needed. The entire Cheltenham Academics website can be based on just these three templates: two column, three column, and generic.
There are a few additional techniques that you can use to optimize the HTML and CSS generated by Fireworks and make it more efficient:
<ul> and <li> styles generated by Fireworks should be consolidated.<div> styles directly to the HTML elements. Fireworks wraps many objects in a <div> and applies the style to the CSS ID for the <div> . For example, a header tagged <h1> in the Fireworks Property inspector will be exported as <p> text object wrapped in a <div> that has the style properties assigned to the <div> . Many of the styles assigned to a <div> ID could instead be assigned to the actual HTML tag. For example, you could convert the <div> ID for a header into a style for the <h1> tag. Then any <h1> object in the website will get that style. You can use this approach for nearly all <hn> , <p> , <span> , <blockquote> , and <a> tags.<div> elements. Then you can define the spacing and alignment of the content as styles applied to the HTML tags rather than as unique CSS IDs for each individual content item. For example, the layout <div> for the center column of the home page might have a padding values for the top and bottom (20 px) and left and right sides (10 px) so that the header text appears 20 px below the top of the module and is 20 px narrower than the <div> rather than assigning a top margin, left margin, and width to the header text itself.clearFloat approach to controlling layout. Fireworks uses this technique to ensure layout consistency across many browsers, but there are other techniques that may be used. Edit the CSS and HTML to use the technique you prefer.There are also additional features in Dreamweaver than can make working with the numerous website files easier and more efficient. Websites are composed of many files, from HTML, CSS, and JavaScript code, to images and multimedia files. Keeping track of the files and dealing with the varied code syntaxes and standards can be difficult.
With the new CSS Inspect mode in Dreamweaver CS5, you can move your mouse around the page and see both the HTML and applied CSS styles highlighted in real time. This makes it much easier to identify the CSS styles that are producing the results you see on the web page so that you know what to edit to change its appearance. To activate CSS Inspect mode, switch to Code and Design view, activate both Live Code and Live View, and then click the Inspect button.
When you use many original design files in Fireworks or Photoshop to create the assets for a website, it can sometimes be challenging to remember which source file was used to create a particular image on a web page. You can use Dreamweaver to create an association between an image and the original file used to create it:
The source file name and location will appear in the Original field in the Property inspector.
When you need to edit an image or change an asset on a web page, select the image in the HTML code or in Design view, and then click the Fireworks icon next to Edit in the Property inspector (see Figure 15).
Fireworks will open the original source file. You can edit the image and save the updated image. When you close the file, Dreamweaver will update the page with the new image.
The combination of Adobe Fireworks CS5 and Adobe Dreamweaver CS5 makes it possible to quickly go from design to code. You export preliminary CSS and HTML from Fireworks and then modify and optimize the code in Dreamweaver. You can even create page templates and libraries to speed further development.
There are numerous other features in both Fireworks and Dreamweaver that you can use to improve your workflow. This tutorial has covered only some of the ways these tools can be used together.
For further reading, refer to the following resources (and don't forget the ones listed in Part 1):
When to use templates, library items, and server-side includes: Designing for web publishing
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.
Tutorials and samples |
| 04/23/2012 | Resolution/Compatibility/liquid layout |
|---|---|
| 04/20/2012 | using local/testing server with cs5 inserting images look fine in the split screen but do not show |
| 04/18/2012 | Ap Div help |
| 04/23/2012 | Updating |