5-21bApply: Case Problem 1
Data Files needed for this Case Problem: gp_cover_txt.html, gp_page1_txt.html, gp_page2_txt.html, gp_page3_txt.html, gp_layout_txt.css, gp_print_txt.css, 2 CSS files, 21 PNG files
Golden Pulps Devan Ryan manages the website Golden Pulps, where he shares tips on collecting and fun stories from the “golden age of comic books”—a period of time covering 1938 through the early 1950s. Devan wants to provide online versions of several classic comic books, which are now in the public domain.
He’s scanned the images from the golden age comic book, America’s Greatest Comics 001, published in March, 1941 by Fawcett Comics and featuring Captain Marvel. He’s written the code for the HTML file and wants you to help him develop a layout design that will be compatible with mobile and desktop devices. Figure 5-59 shows a preview of the mobile and desktop version of a page you’ll create.
Figure 5-59Golden Pulps Sample PageA screenshot shows “Golden Pulps” sample page in mobile and desktop versions.Enlarge Image© 2016 Cengage Learning; © Courtesy Patrick Carey; Source: Comic Book Plus
Complete the following:
1Using your editor, open the gp_cover_txt.html, gp_page1_txt.html, gp_page2_txt.html, gp_page3_txt.html, gp_layout_txt.css, and gp_print_txt.css files from the html05 ► case1 folder. Enter your name and the date in the comment section of each file, and save them as gp_cover.html, gp_page1.html, gp_page2.html, gp_page3.html, gp_layout.css, and gp_print.css respectively.
2Go to the gp_cover.html file in your editor. Add a viewport meta tag to the document head, setting the width of the layout viewport to the device width and setting the initial scale of the viewport to 1.0.
3Create links to the following style sheets: a) the gp_reset.css file to be used with all devices, b) the gp_layout.css file to be used with screen devices, and c) the gp_print.css file to be used for printed output.
4Take some time to study the contents and structure of the file. Note each panel from the comic book is stored as a separate inline image with the class name panel along with class names of size1 to size4 indicating the size of the panel. Size1 is the largest panel down to size4, which is the smallest panel. Close the file, saving your changes.
5Repeat Steps 2 through 4 for the gp_page1.html, gp_page2.html, and gp_page3.html files.
6Go to the gp_layout.css file in your editor. In this style sheet, you’ll create the layout styles for mobile and desktop devices. Note that Devan has used the @import rule to import the gp_designs.css file, which contains several graphical and typographical style rules.
7Go to the Flex Layout Styles section and insert a style rule to display the page body as a flexbox oriented as rows with wrapping. As always, include the latest WebKit browser extension in all of your flex styles.
8The page body content has two main elements. The section element with the ID sheet contains the panels from the comic book page. The article element contains information about the comic book industry during the Golden Age. Devan wants more of the page width to be given to the comic book sheet. Add a style rule that sets the growth and shrink rate of the sheet section to 3 and 1 respectively and set its basis size to 301 pixels.
9Less page width will be given to the article element. Create a style rule to set its flex growth and shrink values to 1 and 3 respectively and set its basis size to 180 pixels.
10Go to the Mobile Devices section and create a media query for screen devices with a maximum width of 480 pixels.
11With mobile devices, Devan wants each comic book panel image to occupy a single row. Create a style rule that sets the width of images belonging to the panel class to 100%.
12For mobile devices, Devan wants the horizontal navigation links to other pages on the Golden Pulps website to be displayed near the bottom of the page. Within the media query, set the flex order of the horizontal navigation list to 99.
13Create a style rule to set the flex order of the body footer to 100. (Hint: There are two footer elements in the document, use a selector that selects the footer element that is a direct child of the body element.)
14Go to the Tablet and Desktop Devices: Greater than 480 pixels section and create a media query that matches screen devices with widths greater than 480 pixels.
15For tablet and desktop devices, you’ll lay out the horizontal navigation list as a single row of links. Within the media query, create a style rule that displays the ul element within the horizontal navigation list as a flexbox, oriented in the row direction with no wrapping. Set the height of the element to 40 pixels.
16For each li element within the ul element of the horizontal navigation list set their growth, shrink, and basis size values to 1, 1, and auto respectively so that each list items grows and shrinks at the same rate.
17With wider screens, Devan does not want the panels to occupy their own rows as is the case with mobile devices. Instead, within the media query create style rules, define the width of the different classes of comic book panel images as follows:
Set the width of size1 img elements to 100%.
Set the width of size2 img elements to 60%.
Set the width of size3 img elements to 40%.
Set the width of size4 img elements to 30%.
18Save your changes to the file and then open the gp_cover.html file in your browser or device emulator. Click the navigation links to view the contents of the cover and first three pages. Verify that with a narrow screen the panels occupy their own rows and with a wider screen the sheets are laid out with several panels per row. Further verify that the horizontal navigation list is placed at the bottom of the page for mobile devices.
19Devan also wants a print style that displays each comic book sheet on its own page and with none of the navigation links. Go to the gp_print.css style sheet in your editor. Add style rules to
hide the nav, footer, and article elements.
set the width of the section element with the ID sheet to 6 inches. Set the top/bottom margin of that element to 0 inches and the left/right margin to auto in order to center it within the printed page.
set the width of size1 images to 5 inches, size2 images to 3 inches, size3 images to 2 inches, and size4 images to 1.5 inches.
20Save your changes to the file and then reload the contents of the comic book pages in your browser and preview the printed pages. Verify that the printed page displays only the website logo, the name of the comic book, and the comic book panels.
gp_back1.pnggp_cover_txt.htmlgp_designs.cssPreview the documentgp_layout_txt.cssPreview the documentgp_layout_txt.cssPreview the documentgp_logo.pnggp_next.pnggp_page1_txt.htmlgp_page2_txt.htmlgp_page3_txt.htmlgp_panel01.pnggp_panel02.pnggp_panel03.pnggp_panel04.pnggp_panel05.pnggp_panel06.pnggp_panel07.pnggp_panel08.pnggp_panel09.pnggp_panel10.pnggp_panel11.pnggp_panel12.pnggp_panel13.pnggp_panel14.pnggp_panel15.pnggp_panel16.pnggp_panel17.pnggp_prev.pnggp_print_txt.cssPreview the documentgp_reset.cssPreview the document
PreviousNext