HTML text formatting (part 2)
This is part 2 of our three tutorials on text formatting.
Read the Text formatting part 1 or Text formatting part 3 tutorials.
This tutorial focuses on:
- Definition lists
- Deleted and inserted text
- Quotations
- Superscripts and subscripts
- Creating spaces
- Lists
Definition lists
A definition list is a list of words together with their definitions organized in a certain manner. Definition lists are created using a few tags.
- Cactus
- A spikey plant
- HTML
- A markup language for the web
NOTE: Bold the terms in a definition list to set them apart from the definitions.
Deleted and inserted text
Deleted and inserted text is displayed with the <del> and <ins> tags.
Quotations
Long quotations are displayed with the <blockquote> tag. Short quotations are displayed with the <q> tag.
With the <q> tag, the browser will automatically display quote marks around the text. With the <blockquote> tag you have to put them yourself.
"Just as treasures are uncovered from the earth, so virtue appears from good deeds, and wisdom appears from a pure and peaceful mind. To walk safely through the maze of human life, one needs the light of wisdom and the guidance of virtue"
The only reward of virtue is virtue; the only way to have a friend is to be one
Superscripts and subscripts
Superscripts
Superscripts are created with the <sup> tag.
Subcripts are created with the <sub> tag.
Creating spaces
Browsers ignore anything more than one consecutive space. The solution to this is the character entity. Every time you insert this character entity into your code, it will create one space.
while.....
Read more about character entities in the HTML text formatting (part 3) tutorial or the full tutorial on HTML entities.
Lists
Lists are an excellent way to present information in an organized fashion. There are three types of lists - numbered (ordered) lists, bulleted (unordered) lists, and definition lists (discussed at the beginning of this tutorial).
Bulleted lists
The bulleted list is a list which includes a bullet next to each item in a list. Bulleted lists are created with the <ul> tag. Each item in the list is displayed with the <li> tag.
- Apples
- Oranges
- Bananas
Discs are the default bullet type in an unordered list, but you can set different bullet types with the type attribute of the <ul> tag.
- Apples
- Oranges
- Bananas
- Lettuce
- Cucumbers
- Tomatoes
Numbered lists
The numbered list is a list which uses numbers instead of bullets next to each item in a list. Numbered lists are created with the <ol> tag. Each item in the list is displayed with the <li> tag.
- HTML
- Javascript
- PHP
You can set different bullet types with the type attribute of the <ol> tag.
- HTML
- Javascript
- PHP
- HTML
- Javascript
- PHP
Lists within lists
It is possible to implement lists within lists. Doing so presents information in a hierarchial fashion, and each level in the list can have a new type of bullet or number, or not.
- Big animals
- Giraffe
- Elephant
- Bear
- Small animals
- Rabbit
- Cat
- Hamster