Borders, boxed text and backgrounds

Text which is intended to be displayed with borders, in a box or with a coloured background in print or electronically should be tagged as follows in DTD 4 XML.

Frames and boxes

The border attribute of the subsection element is used to indicate that a section of text should be displayed in a frame or box.

Note: Netscape does not display the borders in these examples correctly (2001-01-15)

The attribute values for border are based on HTML4 table frame attribute values.


1. Left border

This text has a left-hand border. The markup would be:
<subsection border="lhs"><p>...</p></subsection>


2. Right border

This text has a right-hand border. The markup would be:
<subsection border="rhs"><p>...</p></subsection>


3. Top border

This text has a top border. The markup would be:
<subsection border="above"><p>...</p></subsection>


4. Bottom border

This text has a bottom border. The markup would be:
<subsection border="below"><p>...</p></subsection>


5. Top and bottom borders

This text has a top and bottom border. The markup would be:
<subsection border="hsides"><p>...</p></subsection>


6. Left and right side borders

This text has left and right side borders. The markup would be:
<subsection border="vsides"><p>...</p></subsection>


7. A box

This text appears within a box. The markup would be:
<subsection border="box"><p>...</p></subsection>


Tinted or colour backgrounds

If a section of text is intended to be displayed with a tinted or coloured background the bgcolor attribute of subsection can be used.

This section of text appears with a grey background. The markup would be
<subsection bgcolor="#EEEEEE"><p>...</p></subsection>

Frames and background colours can be combined:

This section of text appears with a grey background. The markup would be
<subsection bgcolor="#EEEEEE" border="box"><p>...</p></subsection>

Back