- Preview Your Pages in Multiscreen Preview
- Set Up Media Queries to Style for Different Devices
- Preview and Edit the CSS for Your Pages in Different Screen Resolutions
Preview and Edit the CSS for Your Pages in Different Screen Resolutions
Next, you will copy the styling from your main style sheet (ours is meridien.css) to the phone and tablet style sheets. Then you will edit the styling to match your design tastes.
- Open the CSS Styles panel (Window > CSS Styles). Make sure that the sitewide.css is listed lastat the bottom of the list (you may need to toggle the arrows to the left of the style sheet names list to hide their styles). You can drag the style sheet names up or down in the CSS Styles panel, if necessary (see Figure 16). The reason why is because you want the main styling applied first, and then the device styling (the styling from sitewide.css). That way, the device styling can override the main styling.
- Click the name of your main style sheet in the Related Files toolbar to see the CSS code (ours is called meridien.css). Insert the cursor in the CSS that appears, then choose Edit > Select All, and then Edit > Copy.
- Click tablet.css in the Related Files toolbar to see the code. Insert the cursor after @charset “UTF-8”; and choose Edit > Paste (see Figure 17). Choose File > Save to save the code.
- Click phone.css in the Related Files toolbar to see the code. Insert the cursor after @charset “UTF-8”; and choose Edit > Paste. Choose File > Save to save the code.
Figure 16 Make sure that the sitewide.css file is listed after your main CSS styling.
Figure 17 Copy and paste styling from the main style sheet to your tablet.css.
Edit the Formatting for Each Device
You now have three style sheets with the same formatting. You need to go in to each and edit the formatting to suit the particular devices.
- Click the Design view button in the Document toolbar.
- Click the arrow to the right of the Multiscreen Preview button, and you will see a list of device sizes. Choose 320x480 Smart Phone to see the page in that size viewing area (see Figure 18). When you choose a device resolution from that menu, Dreamweaver applies the correct style sheet to the Design view depending on what you choose. You can now edit and preview the site right in Design view as if you were looking at it on the device!
- Click the arrow to the right of the Multiscreen Preview button again and choose Orientation Landscape to see what it looks like in a landscape orientation. Choose Orientation Portrait from that same menu to return to the default view.
Figure 18 View the page in Design view in a smartphone-sized viewport.
Edit the Styles
Unfortunately, I cannot tell you what styles to edit, but I can show you the process by which you can edit them:
- In Design view, Cmd+Opt+click (Mac OS) or Ctrl+Alt+click (Windows) some content on your page to see the Code Navigator. Notice that the phone.css is listed beneath the main style sheet (see Figure 19). Essentially, you have two of the same style applied to the page now. This is to simply safeguard against the fact that not all devices and browsers recognize media queries yet. The original styles (meridien.css for us) is applied first, and then the device styles (phone.css in this case for us). If you edit one of the phone.css styles, it will override the meridien.css styles (your original styles).
Figure 19 Edit the phone.css using Code Navigator.