spacer
Yehuda Shiran August 2, 2001
Creating A Master Page
Tips: August 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

The DeviceRect behavior defines the master template of all pages. Use it to place your company logo, to change the background color, or to decorate your margins with a special pattern. You define the master page with a regular <STYLE> element. Of course, you can have a different master page for every rendered page. Suppose we want to define a master page with the following attributes:

  • 8.5 inch wide
  • 11 inch tall
  • Yellow background color
  • 1 pixel wide solid black left border
  • 1 pixel wide solid black top border
  • 4 pixels wide solid black right border
  • 4 pixels wide solid black bottom border
  • 10 pixels wide margin on all sides

We define a style called masterstyle as follows:

<STYLE TYPE="text/css">
.masterstyle
{ 
  width:8.5in;
  height:11in;
  background:#FFFF99;   
  border-left:1 solid black;
  border-top:1 solid black;
  border-right:4 solid black;
  border-bottom:4 solid black;
  margin:10px;
}
</STYLE>
Here is the complete HTML code that displays all master pages:

<HTML XMLNS:IE>
<HEAD>
<?IMPORT NAMESPACE="IE" IMPLEMENTATION="#default">
<STYLE TYPE="text/css">
.masterstyle
{ 
    width:8.5in;
    height:11in;
    background:#FFFF99;   
	border-left:1 solid black;
	border-top:1 solid black;
	border-right:4 solid black;
	border-bottom:4 solid black;
    margin:10px;
}
</STYLE>
</HEAD>
<BODY>

<IE:DEVICERECT ID="page1" CLASS="masterstyle" MEDIA="print">
</IE:DEVICERECT>

<IE:DEVICERECT ID="page2" CLASS="masterstyle" MEDIA="print">
</IE:DEVICERECT>

</BODY>
</HTML>
See what the master page looks like. For more information on print templates, go to Column 89, Print Templates, Part I.


People who read this tip also read these tips:

Look for similar tips by subject:


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Workers Say Telework Is More Productive, Bosses Not So Sure · Kingston Debuts Power-Saving Memory Upgrades · Social Networking is King: Facebook Edges Google