HTML and CSS Reference
In-Depth Information
In this Hands-On Practice you will code special styles to use when printing a Web page.
We will use the page1.html and wildflower.css files that you created in Hands-On
Practice 6.5 as a starting point. Figure 6.18 shows the browser display of the
page1.html file. You will create a new version of the page1.html file and a new style
sheet configured for printing. When printed, the logo will be configured using a 24 pt
size and the navigation will not display.
Getting Started
Locate the pls.jpg, wildflower.css, and page1.html files in the student files, Chapter7
folder. Create a new folder called wildflowersPrint. Copy the files to the folder.
Part 1—Code the XHTML
Launch Notepad and open page1.html. This page is associated with an external style
sheet called wildflower.css. The styles in wildflower.css should be used when the Web
page is displayed on the screen. Add the media attribute with the value of screen to
the link element for wildflower.css. Code a new link element to invoke an external style
sheet called wildflowerprint.css for printing ( media="print" ). The XHTML follows:
<link rel="stylesheet" href="wildflower.css" type="text/css"
media="screen" />
<link rel="stylesheet" href="wildflowerprint.css" type="text/css"
media="print" />
Save the page1.html file in the wildflowersPrint folder.
Part 2—Code the New CSS
Launch Notepad and open wildflower.css. Since you want to keep most of the styles
for printing, you will start by creating a new version of the external style sheet. Save
wildflower.css with the name of wildflowerprint.css in the wildflowersPrint folder. You
will modify three areas on this style sheet: the contentlogo id, the content class, and
the nav class configuration.
1. Modify the contentlogo id so that the printer will use 24 point font size and has
no background color. The CSS follows:
#contentlogo { color: #000000;
font-size: 24pt;
padding: 10px;
2. Modify the content class so that the printer will use 12 point font size. The CSS
.content { font-family: Verdana,Arial,sans-serif;
font-size: 12pt;
margin: 10px;
Search WWH ::

Custom Search