Supported Tags & Attributes

Tk::HyperText supports the following tags and attributes:

Basic HTML Tags

<html>, <head>

It acknowledges that these elements are there, but doesn't do anything with them. But then again, nobody else does anything with them, either.

<title>

If you specify a -titlecommand when configuring your HyperText widget, that callback will be invoked when a <TITLE> tag is found within the HTML code being rendered.

This demonstration program uses such a callback--check out the title on this window.

<body>

The body tag, when found, will recolor the entire HyperText widget with a provided bgcolor and text attribute. Typically, there should only be one <body> in your HTML anyway.

Supported Attributes:
+ bgcolor (background color of the whole page)
+ link (default hyperlink color)
+ vlink (visited link color)
+ alink (active link color)
+ text (default text color)

<link>

The only use for this tag, so far, is to include external style sheets. The "basehref" path is checked for this CSS file.

Supported Attributes:
+ type (only "text/css" or "text/stylesheet" supported)
+ media (only "all" or "screen" rendered)
+ href (path to CSS file, relative to basehref)

<style>

Define a length of code for Cascading Style Sheets.

Supported CSS Attributes:
+ background (only color)
+ background-color
+ color
+ font-family
+ font-size
+ font-weight (bold and normal only)
+ font-style (roman and italic only)
+ text-decoration (underline, line-thru, and none only)
+ text-align
+ Classes, IDs, and Tags

<base>

Let the page define its own "base href", which is used for looking up images and style sheets for the current page.

Supported Attributes:
+ href (the address)

Text Markup

<basefont>, <font>

Change your font, color, size, or highlight color. Basefont defines the default font settings.

Supported Attributes:
+ face (the font family)
+ size (size, in HTML units, from 0 to 6)
+ color (text color)
+ back (highlight color)

<a>

The <a> tag is only supported as a means of hyperlinking. Support for in-page linking (e.g. <a name>) isn't working yet. If you define a -linkcommand in your HyperText configuration, it will be invoked whenever a hyperlink is clicked on.

Supported Attributes:
+ href (the URL to link to)
+ target (the intended target, e.g. _blank)

<blockquote>

Creates a block of indented text.

<div>, <span>

Create a division or span of text. These are most useful when paired with CSS, as it is in real HTML. The div tag supports the attribute "align".

<p>, <br>

<p> creates a block-level section of text, or it can be used by itself to insert two newlines in your page. <br> inserts a single newline.

<ol>, <ul>, <li>

Create ordered lists, unordered lists, and list items, respectively.

Ordered List Attributes:
+ type (bullet type, should be 1 for numbers, A or a for letters, I or i for roman numerals)
+ start (the number to start the list at)

Unordered List Attributes:
+ type (bullet type, should be: circle, disc, square, diamonds, or a decimal escape code, e.g. "#0164")

<pre>

Inserts a block-level element of preformatted, Courier New text.

<code>, <tt>, <kbd>, <samp>

Creates inline "typewriter" text.

<center>, <right>, <left>

Change your text's justification to centered, right, or left.

<h1> - <h6>

Create headings, as seen on this and other pages in the demo.

<sup> - <sub>

Create superscripted and subscripted text, respectively.

<b>, <strong>

Create bold (strong) text.

<i>, <em>, <address>, <cite>, <var>, <def>

Create italicized (emphasized) text.

<u>, <ins>

Create underlined (inserted) text.

<s>, <del>

Create overstriked (deleted) text.

Object Tags

<img>

Insert an image into the page. The "base href" is checked for the loading of this image. If the image wasn't found, a standard "broken image" is used instead.

Supported Attributes:
+ src (path to the image)
+ hspace (horizontal padding)
+ vspace (vertical padding)
+ align (must be top, middle, or bottom; left/right not supported)

<hr>

Insert a horizontal rule into the page, such as this one:
Supported Attributes:
+ width (width of the horizontal rule)
+ size (height)