Whether you’re new to building websites or you’re a seasoned developer, Dreamweaver is one of those tools that’s hard to live without. Rather than using a suite of tools and utilities, you can use the visual preview features, coding tools, and server-related tools in Dreamweaver to speed development.
In this article, I guide you through some of the new features in Dreamweaver CS6 and introduce you to a basic workflow for creating a simple website. You’ll build a template for a photo gallery website, including a home page, detail pages, and a navigation bar (click Figure 1 to see a running example). Along the way, you’ll learn how to use the new Fluid Grid Layout feature, CSS3 transitions, and Dreamweaver templates.
Figure 1. Fluid design of the sample project shown in desktop (left) and mobile (right) sizes (click to explore site).
Step 1: Plan the website
The first thing to do is define the pages that will be included in the website and the visual theme the pages will use for branding and layout. This can be quite an extensive task for complex websites, but for the purposes of this tutorial, the photo gallery will follow a very simple design (see Figure 2).
Figure 2. Overview of the website layout template.
Essentially the gallery is composed of a single layout used to build a home page and detail pages. Since the pages will all follow the same design, it’s a good idea to use a Dreamweaver template.
Step 2: Create a new site in Dreamweaver
Dreamweaver organizes projects by website and provides the Files and Assets panels so you can easily organize and deploy content. In this step, you’ll set up the website folder and then create a new site in Dreamweaver.
Before you get started:
- Download the project files (ZIP, 9 MB) and unzip the archive. Save your published files in this folder and use the project assets to follow the steps in the tutorial.
- Download the completed project files (ZIP, 9 MB) to use as a reference. You can deconstruct these files if you run into any problems.
- Download the free trial of Dreamweaver CS6 and install the application if you haven’t already done so. You can also use your Creative Cloud membership to download and install the product.
Create a new file and start the project:
- Open Dreamweaver and choose Site > New Site.
- In the Site Setup dialog box, enter Photo Gallery in the Site Name field and click the folder next to the Local Site Folder field to browse for the dwcs6_project folder, which is included in the project files you just downloaded.
- Click Save to create the site. Notice that the Files and Assets panels now reflect the content inside the website project folder. Note that you’ll use supplied content from the _Source and Images folders.
- Before you get started, take a moment to explore the Dreamweaver workspace (see Figure 3). The main area of the screen changes depending on whether you’re looking at the Code view, Design view, Split view, or Live View mode. This area is where you’ll see your work. The Properties panel on the bottom of the screen is context sensitive and displays properties for any selected object. The Files and Assets panels enable you to manage files in the website. The CSS Styles panel enables you to manage text and formatting styles throughout the website. The Mobile Size, Tablet Size, and Desktop Size buttons on the bottom of the screen in Design view enable you to check your work at standard sizes.
- Close the blank HTML file when you are done.
Figure 3. Dreamweaver CS6 workspace.
Step 3: Lay out the website template using Fluid Grid Layout
The Fluid Grid Layout feature is new to Dreamweaver CS6. It provides an easy way to use CSS to create fluid page layouts that can size themselves to any screen or device. In this step, you’ll create the foundation for the website template:
- Choose File > New Fluid Grid Layout to launch the New Document dialog box. Notice that the Fluid Grid Layout options include settings for mobile, tablet, and desktop sizes. The concept is that you’ll lay out content in a grid of div tags set to fluidly span the page. Each of the three sizes can define its own CSS layout for each div tag. In this step, you can change the number of columns, spacing, and margins for each layout.
- Change the column width from 25% to 15% and change the margin setting to 90% for all three sizes (see Figure 4).
Figure 4. Fluid Grid Layout options in the New Document dialog box.
- When you click the Create button, Dreamweaver will generate a CSS file to save your grid CSS settings as you work. Click Create and save the CSS file with the name GalleryTemplate.css in the Assets folder.
- Notice that Design view updates, and you now see the grid layout in the mobile screen size.
At this point, the page appears as a series of column guides and one fluid grid layout div tag creating a row in the grid.
Step 4: Add div tags and placeholder content
HTML is simply a tree of nested tags that defines the relationship of content on a web page. In this example, the part of the HTML you see in a browser starts with the <body> tag, followed by nested <div> tags and a closing </body> tag. A div tag is an organizational element used to group content on the page in a logical way. CSS styles can be assigned to each div tag to format text and add layout styles such as position, background, and border.
In this step, you’ll create three div tags as rows in the grid and add placeholder content:
- Select the text in the existing div tag and delete it. This div tag will hold the large image.
- Place the cursor in the div tag and type Add image here as a placeholder for the template.
- Click the Split button on the top left side of the workspace to display both Code view and Design view. It’s often easier to edit and fix issues in Code view.
- Add another div tag by selecting the LayoutDiv1 tag in the code or along the tag selector (see Figure 5) and choose Insert > Layout Object > Fluid Grid Layout Div Tag. Click OK to accept the default settings. Selecting the previous div tag before inserting the next div tag is an important step to make sure the tags are next to each other in the code hierarchy.
Figure 5. Two ways to select a div tag.
- Delete the text in the new div tag and type Add text here as a placeholder.
- Add another fluid grid layout div tag to add another row below the text row. This div tag will hold a series of thumbnail images.
- Click inside the new div tag and choose Insert > Image. Browse for the image1.jpg file from the Images/Thumb folder and click OK. Enter the alt text Image 1 when prompted and click OK. Repeat this process for the remaining nine thumbnail images. You can also drag the images to the div tag from the Files or Assets panel, or you can add the images by copying and pasting the <img> tag in Code view while updating the file reference.
Right now, the template has all the elements needed to produce the website pages, but it could use some style formatting to refine the layout (see Figure 6).
Figure 6. The div tag layout filled with placeholder content.
Step 5: Add styles to format the layout
CSS styles enable you to format the text and visual presentation of the div tag layout. Separating the formatting definition from the definition of the content in the div tags allows for a flexible design workflow.
In this step, you’ll format the background color, font styles, div tag layout styles, and thumbnail image styles to format the template:
- Choose Modify > Page Properties to open the Page Properties dialog box. You can use Page Properties to define global settings for the page.
- Update the following properties under the Appearance (CSS) category and click OK:
- Page font: Trebuchet MS, Arial, Helvetica, or another sans-serif font
- Size: 16
- Text color: #FFF
- Background color: #333
- Add more styles to the body tag to center-align all the content and add some top padding. To do this, click the All button at the top of the CSS Styles panel to show all the style rules in the site. Click the body rule below the <style> tree control, which shows the background-color style you just added in the Page Properties settings.
- To add a property, click the Add Property button, choose the property from the menu, and enter a value in the resulting field. Add the following properties:
- text-align: center
- padding-top: 20px
- The fluid grid layout page always appears with a parent div tag that contains all your other div tags. Add styles to the parent div by selecting it in the code or by clicking the outermost CSS layout guide box in Design view. Click the Current button in the CSS Styles panel and add the following styles:
- border: solid 8px #000
- background-color: #000
Tip: The fluid grid layout is composed of three sets of CSS, one for each device size. You always want to start your layout in the mobile size because the styles you define there will be inherited by the other two layouts.
- Click anywhere in the second div tag to select it. Notice that the div tag’s styles appear in the CSS Styles panel. Add the following styles:
- padding-top: 12
- padding-bottom: 12
- Add some spacing to the images by adjusting their margin style. Click one of the thumbnail images to select it and click the New CSS Rule button on the bottom of the CSS Styles panel. Click OK in the New CSS Rule dialog box. Add the following styles in the Box category in the CSS Rule Definition dialog box and then click OK to apply the style:
- border: solid 1px #000
- opacity: .75
- Save the file.
At this point, the layout.html page is ready to be converted to a Dreamweaver template (see Figure 7).
Figure 7. A website template at mobile size built with CSS formatting applied.
Step 6: Create a Dreamweaver template with editable regions
This website is purposefully designed to be very simple with the gallery pages sharing the same layout. Rather than redoing all the work for each page or copying and pasting the code, you can create a Dreamweaver template (DWT) file. A Dreamweaver template contains editable and non-editable regions that can be used to define consistent approaches to layout and branding. The template remains linked to each page you apply it to, which makes it easy to add global changes from a single location.
In this step, you’ll create a DWT template from the layout.html file with editable and non-editable regions:
- With the layout.html file still in the view, choose File > Save As Template. The Save As Template dialog box appears.
- Add a brief description and change the Save As filename to GalleryTemplate.
- Click the Save button to create the template. In the Files panel, you can see that a new folder named Templates appears in the site, and the file has been saved as GalleryTemplate.dwt.
- Select the Add image here text and choose Insert > Template Objects > Editable Region. The New Editable Region dialog box appears. Enter the name Image Area and click OK.
- Select Add text here and repeat step 4. Name the editable region Text Area.
- Save the file.
At this point, you’re ready to create the gallery pages using the DWT template (see Figure 8).
Figure 8. Dreamweaver template in editing mode.
Step 7: Create the website pages by adding images and text
Creating the gallery pages is easy. All you have to do is create a new page using the template and drop the supplied images and text into the placeholder areas.
In this step, you’ll create the detail pages using the template and supplied assets:
- Choose File > New > Page From Template > GalleryTemplate and click Create. Explore the new page and notice that only the three editable regions can be changed.
- Create a home page by saving the file with the name index.html. Web servers will automatically show the index.html page when you browse to the URL of the website.
- Delete the template text in the Image Area and place the cursor in the Image Area editable region.
- Choose Insert > Image and browse for the HomePageImage.psd file in the _Source folder. Because the image is a Photoshop file, Dreamweaver asks for publish settings in the Image Optimization dialog box. Click OK to accept the default publish settings in JPEG format and save the resulting image in the Images folder. If you happen to update the PSD file in Photoshop, Dreamweaver will automatically update the JPEG file. Enter the alt text Home Page when prompted.
Tip: Dreamweaver CS6 includes a simple set of image editing controls available in the Properties panel when an image is selected. You can perform tasks such as cropping, resampling, or changing the brightness and contrast directly in Dreamweaver without needing additional image editing software on your computer.
- Delete the text in the Text Area editable region and type Click a thumbnail to view the image.
- Save the file.
- Create another new page from the template and save the file with the name page1.html.
- Delete the template text in the Image Area and replace it with image1.jpg from the Images/Full folder. Enter the alt text Image 1 when prompted.
- Delete the text in the Text Area and add the text Photograph 1 in its place.
- Save the file.
- Repeat steps 7 through 10 for each of the remaining images to change the filename and text to match the image number in the sequence.
At this point, your pages are filled with content, and they are ready to be linked together (see Figure 9).
Figure 9. The home page after content was added to a Dreamweaver template instance.
Step 8: Create a navigation bar
Navigation bars are a common feature in website design and can appear in many forms. Essentially they create hyperlinks between pages in the website (or elsewhere), and they provide a visual cue as a call to action.
In this step, you’ll convert the thumbnail images to a navigation bar:
- Return to the GalleryTemplate.dwt page (which you can open from the Templates folder in the Files panel if you need to). You’ll add the navigation links to the template so each of the pages implementing the template inherit the update.
- Click the first thumbnail on the left (image1.jpg) to select it. Click the Point To File icon next to the Link field in the Properties panel and drag the cursor to the file you want to link to in the Files panel (see Figure 10). You can manually enter any URL in the Link field, but using the Point To File feature ensures that the link from the template in the Templates folder to the target HTML page is correct.
Figure 10. Create a hyperlink using the Point To File tool (click to enlarge).
- Repeat step 2 for each thumbnail image and HTML file.
- Save the file and choose update links when prompted.
Step 9: Add CSS3 page transitions
CSS3 transitions provide a new level of animation support directly to the HTML environment, enabling Flash like effects using web standard technologies.
In this step, you’ll add CSS3 rollover transitions to the thumbnail images to create a visually engaging experience:
- Return to the GalleryTemplate.dwt page if you’re not already there.
- Select a thumbnail image and choose Window > CSS Transitions to open the CSS Transitions panel.
- Click the Create New Transition button (+) to launch the New Transition dialog box (see Figure 11).
- Change the following parameters:
- Target Rule:
.gridContainer.clearfix #LayoutDiv3 img
- Transition On: Hover
- Duration: .5s
- Delay: 0s
- Timing Function: Ease-Out
- Target Rule:
- The rollover effect will add a white highlight to the border of the thumbnail image, and the image will become completely visible. Click the Plus button under the Property area and set the following styles and values:
- opacity: 1
- Click Create Transition to add the transition styles to the site.
- Save the file.
Tip: CSS transitions are supported in the following browsers: Chrome 1.0, Safari 3.2, Firefox 4.0, Internet Explorer 10, and Opera 10.5.
At this point, you’ve created the home page and detail pages, and you’ve added the finishing touches to the navigation bar with a CSS3 transition.
Figure 11. New Transition dialog box.
Step 10: Preview and deploy your work
It’s a good idea to preview your work often as you build the website. Dreamweaver CS6 provides several ways to preview, including using Design view, using Live View, using Multiscreen Preview, and previewing in a browser.
You’ll find that using Design view and Live View are the easiest ways to check your work before publishing. Previewing in a browser is a common task that shows your work in your default browser. Multiscreen Preview is useful when checking your work for mobile and tablet sizes. In this step, you’ll explore your options for previewing your work.
Check your work using Live View:
- Click the Live button at the top left of the workspace. Once you enter this mode, you can preview CSS3 and HTML5 features in the workspace.
- Click the Live button again to return to Design view.
- Save the file.
Check your work by previewing in a browser:
- Choose File > Preview In Browser to launch the current page in the target browser. You can also launch the page using the Preview/Debug In Browser button above Design view.
- Change the size of the browser window to see the fluid layout resize itself.
Tip: It’s a good idea to use this option as opposed to simply opening the page in a browser because it saves all the dependent files where the CSS is stored.
Check your work using Multiscreen Preview by choosing Window > Multiscreen Preview.
Now that the website is complete, you’ll need to upload it to a server so that people surfing the Internet can see it. You can use any FTP tool to accomplish this, but the Dreamweaver Files panel has FTP capabilities built into it. Dreamweaver CS6 includes performance improvements so you can upload large files and large websites faster and more efficiently than before.
Explore using the Dreamweaver FTP tool:
- In the Files panel, click the Expand To Show Local And Remote Sites button in the upper right. This button expands the panel to show the file system locally and on your remote server.
- From the main menu, choose Site > New Site to bring up the Site Setup dialog box.
- Click the Plus button to add a new server.
- Enter your server’s name, FTP address, username, and password, and click Save.
- Click Save in the Site Setup dialog box to save the change.
- From here, you can click the Connect To Remote Server button to log into your FTP server. Then select files to upload and click the Put Files button (up arrow). You can add, remove, and synchronize files as needed.
- Click the Expand To Show button (now called Collapse) and click Show Only Local or Remote Site. Return to editing view.
Tip: If you’re new to building websites, you’ll need to buy a unique domain name and pay for a host service to provide a server. The server host should provide you with an FTP host address and a username and password to log in.
Where to go from here
Tutorial provided by: Adobe