HTML

From Tygron Support wiki
Jump to navigation Jump to search
This article is a stub.

Template:Learned

HTML

HTML stands for HyperText Markup Language. It is a language used to indicate how text or content should be laid out for display. Along with Cascading Style Sheets (CSS), it is generally used for styling webpages.

How HTML relates to the Tygron Engine

In the Tygron Engine, there are a number of places where the user is responsible for providing text and information. When that information can be complex, such as the Excel output for an Excel (Indicator), the Engine allows HTML to be used for determining how the information should be laid out. The Engine is effectively HTML5 compliant for these purposes.

How HTML is structured

HTML consists of a number of elements, which are demarked by two tags: an opening and a closing tag. The opening tag indicates where an element starts, and the closing tag indicates where an element finishes. Each tag consists of a word or a few characters, enclosed by less-than and greater-than characters (< and >). A closing tag has an additional slash in it to indicate it's a closing tag. For example, a full element is constructed as follows: <element>hello!</element>.

Elements can also have attributes. Attributes configure or fine-tune the behavior of the elements. They generally consist of a key and a value, linked by an "equals" sign. Attributes are placed in the opening tag, and not in the closing tag. For example, an attribute to indicate an intended address: <a href='www.example.com'>Link to another site</a>. Here, the attribute is "href", and the value is "www.example.com".

There are also tags which are used by themselves, and do not require a closing tag. These are elements like <br>, which insert a linebreak in the layout at the location of the element.

HTML is best inspected when properly formatted, with linebreaks and indentation to indicate where certain elements begin and end. However, this is not neccesary for the interpretation of HTML. The following pieces of HTML will generate the same output:

<element>
  <element>
    Text
  </element>
</element>

is interpreted the same as

<element><element>Text</element></element>

Using HTML

The full span of the capabilities of HTML extends far beyond the scope of this wiki. Instead, some basic elements will be explained here which will allow you to tackle most formatting challenges. For further information regarding HTML, CSS and javascript, please refer to other online information sources.

Text formatting

An example display with some basic text styling.
An example display with the available headings.

For basic text styling, a number of elements exist.

Paragraph: <p>

The paragraph element <p>paragraph</p> is used to define a segment of text which is supposed to appear as a paragraph of text. A paragraph is slightly indented, and is surrounded by a bit of empty space. This automatically separates consecutive paragraphs, for easy of reading.

Horizontal rule: <hr>

The horizontal rule element <hr> inserts a horizontal line into the layout. Horizontal lines are useful for separating segments of information.

Linebreak: <br>

The linebreak element <br> indicates that in this point of the layout, the line ends. Anything that comes after should appear on a new line.

Headings: <h1>, <h2>, etc

The heading elements <h1>heading</h1>, <h2>heading</h2>, (continuing through to <h6>heading</h6>) are generally used for titles. The lower the number, the larger and more prominent the title.

Tables

An example display with a table.

A table element consists of multiple nested elements. The main element is <table>the table</table>. A table consists of one or multiple rows, which are also elements. A row element is <tr>the row</tr>. In turn, each row consists of one or multiple cells, which are also elements. The cell elements are <td>the cell</td>. The net result for a full table will look something like this:

<table>
<tr> <td> A </td> <td> B </td> </tr>
<tr> <td> C </td> <td> D </td> </tr>
</table>

is interpreted as

<table>
<tr> <td> A </td> <td> B </td> </tr>
<tr> <td> C </td> <td> D </td> </tr>
</table>

and thus becomes

  A     B  
  C     D  

Colspan and Rowspan

When a cell has to span multiple rows or columns, the colspan and rowspan attributes can be used.

<table>
<tr> <td colspan=2> A </td> </tr>
<tr> <td> C </td> <td> D </td> </tr>
</table>

would result in

  A  
  C     D  

Using CSS styling

It is possible to further style many elements using the "style" attribute. This attribute accepts CSS-style keys and values, which can be used to change how certain elements behave in terms of layout, and can be used to increase readability of text. The style attribute accepts one or more key-value pairs, with the key and the value linked with a colon, and each pair separated with a semicolon. For example, to use a style attribute to set both the width and height of an element: <table style='width:100px;height:150px;'>.

Width, Height

The width and height of an element. It is possible to set either, or both.

Example: <td style='width:100px;height:20px;'>

The width is especially useful when fine-tuning the usage of horizontal space in tables, by setting the width of individual cells on a single row.

Text-align

The alignment of an element means the alignment of text within that element. It can be set to "left", "right", "center".

Example: <td style='text-align:right;'>

Nested elements, which have "display:inline" as styling, are also aligned.

Color

The color or an element refers to the color of text in that element. It can be set to any valid CSS color code.

Example: <td style='color:#00ff00;'>