Cascading Style Sheets and Precedence Rules

As the term "cascading" implies, you can apply several style sheets to a single document at the same time. For example, you may associate one style sheet with a document itself, link another style sheet to the first, and then associate a third with the Web browser on which the document is displayed. When multiple style sheets are in effect, they are applied to the document in a predetermined sequence set by the browser (not by FOCUS). The formatting cascades from one style sheet to the next. The precedence of style sheet methods, from highest priority to lowest, is as follows:

  1. Inline Style.
  2. Internal Style Sheet.
  3. External Style Sheet.
  4. Browser default.

Inline styles are physically defined within specific HTML elements, and cannot be overridden. An internal Style Sheet, whether coded by you or generated by FOCUS, consists of formatting declarations placed within the <head> tag of the generated HTML file. It is the way you typically override styling defaults established in an external cascading style sheet that resides on a corporate LAN server, and serves as a basic Web document template. External cascading style sheets offer an excellent mechanism for centralizing control of corporate publications throughout a site, but also save you the effort of repeating basic styling instructions from one report request to the next. Finally, you can set your Web browser to observe or ignore cascading style sheets, assuming it is capable of supporting them in the first place. You and the readers of any documents styled with CSS must have CSS-enabled browsers to view or work with them.

The actual process for using cascading style sheets in mainframe FOCUS involves several steps. First, in a FOCUS session specify (or link to) the style attributes that you wish to apply, and create a HOLD file in HTML format. The rest of this chapter discusses formatting methods and alternatives. After running your request, leave FOCUS and transfer the HOLD file to your browser using FTP or another file transfer protocol. Then open the HTML file in your browser and view and work with the HTML file contents.


Information Builders