HTML/XHTML:More basic tags
|Table of contents|
Text can be formatted using the following tags;
- The <p> tag is used to create a new paragraph
- The <br /> tag specifies a line break between blocks of text. Although there are variations of the br tag, (<br>,</br>) get use to the XHTML format of <br /> )
- The <pre> ... </pre> tag is useful for formatting text where white space is important (where spaces are to be included).
- The <div> ... </div> tag is useful for formatting a block of text, and is commonly used with style sheets.
- Alignment (left, center, right) can be achieved using the container tag align, for example align = "center" (Though this really should be done via a style)
TASK: Add and edit the body of one.html as shown above .
- All media elements such as text (including headings) and graphics are automatically left aligned
- Traditionally text alignment has been achieved using a container tag (one attached to another tag). For example
- <div style="text-align: center">, remembering to turn it off with </div>
- <p style="text-align: right">, remembering to turn it off with </p>
- <h2 style="text-align: center">, remembering to turn it off with </h2>
- To center text (or other items on a page), you can also use the <center> and </center> tags. (Note: center is spelt the American way!). Using the <center> tag and the align attribute is today discouraged and being replaced (deprecated) by the use of Style Sheets. (Deprecated means "being phased out").
- If bullet text is aligned the lines will be double spaced. (More on this later).
Lines (horizontal ruler)
A line can be inserted into the page by using the <hr> tag. For example
Where size = height of the line in pixels.
The hr tag can also be expressed in the number of pixels, For example
where 333 is the number of pixels across
If you want to add really flashy lines, you can include them as an image. For example create a line that is animated (this will be covered later).