HRDIODB
[ class tree: HRDIODB ] [ index: HRDIODB ] [ all elements ]
Prev Next
Cascading Style Sheets

Cascading Style Sheets

HRDIODB makes use of Cascading Style Sheets (CSS) for various look and feel settings. CSS allow a web designer to specify how HTML elements should be displayed in the browser window. CSS are supported in all modern browsers, though the level and detail of support varies greatly. Based on that fact, some page layout and alignment properties were specified via HTML tags to maintain a consistent look across browsers and platforms. For an overview and tutorial of CSS, please reference the W3Schools CSS Tutorial.

Written by Ziba R. Scott and Adam D. Gorski

Table of Contents

hrdi.css

The main HRDIODB CSS is located in the hrdi.css file. The file contains styles for base HTML elements as well as specific element ids and classes. Changing the look and properties of any element in the file will affect that element throughout all of the pages. For example, let's say we want to change the font size of all text which isn't controlled by any other element style, meaning all of the text outside the layout tables and not within any other spans or divs. We would open the hrdi.css file and locate the following block of code:

  1. /* Main body */
  2. body {
  3.   color#000000;
  4.     font-familyhelveticasans-serif;
  5.   font-size10pt;
  6.   background-color#FFFFFF;
  7.     margin0px;
  8. }

To change the font size from 10pt to 8pt, we would modify the block of code to look like this:

  1. /* Main body */
  2. body {
  3.   color#000000;
  4.     font-familyhelveticasans-serif;
  5.   font-size8pt;
  6.   background-color#FFFFFF;
  7.     margin0px;
  8. }

print.css

It would be possible to print out HRDIODB pages without a specific print CSS, but chances are that the page wouldn't look as good as one would hope. In order to make the HRDIODB more printer friendly, a special print CSS is used. It is possible to tell a browser which CSS to use for which rendering. In the header.php file, we specify two CSS; hrdi.css and print.css. The hrdi.css file is used for "all" media, meaning for any rendering. The print.css file is used for the "print" media, meaning rendering for a printer. The HTML for specifying these CSS is shown below.

  1. <link rel="stylesheet" media="all" href="hrdi.css" type="text/css" />
  2. <link rel="stylesheet" media="print" href="print.css" type="text/css" />

The print.css file should be a modified version of the hrdi.css file. The modifications could consist of changing colors to printer safe colors, such as blacks and grays for a non-color printer. Font sizes could be adjusted and font styles could be changed. A common function of the print CSS is to hide certain page elements, specifically those which do not need to be included on a print out of the page. As an example, consider the HRDIODB navigational bar (the blue bar at the top of the page). In the hrdi.css file, the style for that bar is defined as follows:

  1. /* Navigational bar */
  2. .nav_bar {
  3.   color#FFFFFF; 
  4.     font-size10pt;
  5.   background-color#0066FF;
  6.     width100%;
  7.   border0px solid;
  8.   padding0px;
  9.   margin0px;
  10. }

If we want the navigational bar to be hidden for the printable version of the page, we would specify it in the print.css file as follows:

  1. /* Navigational bar */
  2. .nav_bar {
  3.   displaynone;
  4. }

The property display: none tells the browser to not display the page element. The PHP code has not changed, as far as PHP is concerned the navigational bar is still being displayed. It is the CSS that tells the browser to hide it if the user goes to print the page. This can be done for almost any style in order to hide unwanted page elements.


Prev   Next
Offline Mode Using the CSV Uploader

Documentation generated on Tue, 23 Jan 2007 22:57:38 -0500 by phpDocumentor 1.3.0RC6