TABLE OF CONTENTS
Section I: How to Use Libraries Section II: How to Add Flash to a Website Section III: How to Create Image Maps Section IV: How to Create Rollover Images Section V: Mobile friendly web pages
3.
Library button
2. 3.
4. 5.
9.
Click OK to close the dialog box and insert the video. A Flash Video placeholder appears in your document (Figure 8).
10. Select File > Preview In Browser and select a browser from the submenu to preview the page and test the video.
6.
Select one of the hotspot tools located below the Map name, and draw a rectangle, circle, or polygon around a part of the image (Figure 3). In the Hotspot Property inspector (Figure 4), do the following: Add a link to a page in your site or to an external URL. Type a descriptive phrase for the link destination in the Alt text box.
Image map
7.
8. 9.
Repeat steps 6 and 7 to add other hotspots in the image map. Save the page.
Hotspot tools
10. Select File > Preview In Browser and select a browser from the submenu to preview the page and test each link.
5. 6. 7.
Click OK to close the dialog box. Save the page. Select File > Preview In Browser and select a browser from the submenu to preview the rollover image and test the link.
4.
Dynamically size an image The header image creates our first challenge. This image will be too large to work with mobile devices. Well solve this issue by deleting the image height and width attributes from the html and sizing the image using CSS.
The Properties Inspector with image selected and the width and height attributes deleted. 1. 2. With the image selected delete the height and width attributes in the Properties Inspector. Next, in the CSS file, create a new style for the header image:
By removing the height and width attributes from the menu tag and using a percentage value in the CSS width property we cause the image to resize dynamically as the width of the page changes.
10
The Media Queries dialog 1. Select the Insert>Media Queries menu item
11
In the Media Queries dialog: 2. Under Write media queries to click to choose the Site-wide media queries file option (you can choose to save the queries to the current document but saving them to an external file makes them available for all of your sites files). Click the Specify button to create and save your media query file. Name the file media.css and save it where the main CSS file exists. Leave Force devices to report actual width checked. Click the Default Presets button in the lower-right corner of the Phone/Tablet/Desktop section of the dialog box. This will define three media queries (for desktops, tablets and phones) but youll still need to create and save a CSS file for each of the queries.
3. 4. 5.
Create the CSS files: 6. 7. 8. 9. Select the Phone query from the list if its not already selected. In the Properties section. accept the defaults for Description and Min and Max Width. Choose the Create new file menu option and click the folder icon to create and save your phone-based CSS file. Name the file phone.css and saved it in the same folder as media.css. Repeat the steps above to create CSS files for Tablets and Desktops naming the remaining files tablet.css and desktop.css as in the Media Queries image on the previous page.
10. Click OK to close the Media Queries dialog. Note: Snce we want the style rules in our media query files to overwrite style rules with the same names in the default CSS file, the link to the media query file (media.css) MUST appear after the link to the main CSS file as shown below. It should happen that way by default but, if the order is reversed, youll need to fix it in the code. <link href="styles.css" rel="stylesheet" type="text/css"> <link href="css/media.css" rel="stylesheet" type="text/css"> To edit Adobes default media queries or add more, you can do that at any time by choosing the Modify>Media Queries menu option.
12
The tablet.css file Since the layout by default is designed for larger screens, ignore the desktop.css for now and concentrate on tablets and phones. Lets begin with tablets. The first thing we need to change is the min-width property for our header div. Since the tablet media query is used for screens from 321 to 768 pixels a value of 320 pixels needs to be set. Unfortunately the min-width property is not supported in Dreamweavers Rule Definition dialog so well need to add the rule directly in the code of tablet.css. Min-width 1. 2. Make sure you are working in Split View and click the tablet.css link in the Related Files list at the top of the Document window. The tablet.css file will be displayed on the left in the code portion of the Split window (see figure below). Add the min-width property to each container DIV with a value of 320px. Example: .header { min-width: 320px; }
Split View with tablet.css selected in the Related Files toolbar and displayed in the Code section of the Document window.
13
You should be able to see the effect of this rule by switching to Live View and resizing the document window. Select a size from the menu revealed by clicking on the down arrow at the right of the Multiscreen button in the Document Toolbar at the top of the Document window (see below).
Selecting a preview screen size from the Multiscreen menu. The phone.css file We need similar rules for phone.css with the a couple changes: The min-width of the layout will be 200px, which should accommodate even pretty dumb smart phones. And well let the buttons be the full width of the layout. So our phone.css file will look like this: @charset "utf-8"; .header { min-width: 200px } .menu { min-width: 200px } .content { min-width: 200px }
14
The finished page You can preview the layout at multiple screen resolutions simultaneously Select a size from the menu revealed by clicking on the Multiscreen button in the Document Toolbar at the top of the Document window.
A multiscreen preview of the page showing the different layouts for phone, tablet and desktop devices. The Figure above shows the Multiscreen preview of our customized layout. With just a few simple style rules weve created a layout that comfortably accommodates mobile devices and still looks good on a desktop computer.
15