Backup Copy of A694875 - Formatting Text

0 Conversations

Tags in HTML can have many "attributes", or customizable features. Take, for instance, the paragraph tag. You can specify how you want the tag aligned: "left", "right", or "center".


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Testing Paragraphs
</title>
</head>
<body>
<p align="left"> blah blah blah </p>
<p align="right"> blah blah blah </p>
<p align="center"> blah blah blah </p>
</body>
</html>

In a similar vein, if you want to quote a largish passage from some author you can use the blockquote tag. This will justify the text (center it, and make all the text line up evenly on both sides so you have a solid block of text instead of getting a jagged right edge).

<blockquote> yadda yadda yadda </blockquote>
blahblahblahyakyakyaketcetcetcyaddayaddayaddachatterchatterchatter. blahblahblahyakyakyaketcetcetcyaddayaddayaddachatterchatterchatter. blahblahblahyakyakyaketcetcetcyaddayaddayaddachatterchatterchatter. blahblahblahyakyakyaketcetcetcyaddayaddayaddachatterchatterchatter. blahblahblahyakyakyaketcetcetcyaddayaddayaddachatterchatterchatter. blahblahblahyakyakyaketcetcetcyaddayaddayaddachatterchatterchatter. blahblahblahyakyakyaketcetcetcyaddayaddayaddachatterchatterchatter.

Lists

While you could do lists with just paragraphs and line breaks, HTML has tags that will allow you to get a much nicer-looking list with very little effort.

Unordered lists are ones that just use bullets for each item in the list.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Testing Lists 1
</title>
</head>
<body>
<ul>
<li> first item </li>
<li> second item </li>
<li> third item </li>
<li> etc </li>
</ul>
</body>
</html>

Gives:

  • first item
  • second item
  • third item
  • etc

Ordered lists use either upper- or lowercase letters, Roman or Arabic numerals to count off the different items. When you specify the type, simply put either "1","i","I","a", or "A" to show which kind of counting you want to use. I'll choose a numbered one with Arabic numerals:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Testing Lists 2
</title>
</head>
<body>
<ol type="1">
<li> first item </li>
<li> second item </li>
<li> third item </li>
<li> etc </li>
</ol>
</body>
</html>

Gives:

  1. first item
  2. second item
  3. third item
  4. etc

A definition list <dl> is made up of alternating a definition term <dt> and a definition description <dd>.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Testing Lists 3
</title>
</head>
<body>
<dl>
<dt> Item 1 </dt>
<dd> Lots of stuff about Item 1. blahblah blah yakyakyaketcetcetc yaddayaddayadda chatter chatter chatter. blahblah blah yakyakyaketcetcetc yaddayaddayadda chatter chatter chatter.</dd>
<dt> Item 2 </dt>
<dd> Lots of stuff about Item 2. blahblah blah yakyakyaketcetcetc yaddayaddayadda chatter chatter chatter. blahblah blah yakyakyaketcetcetc yaddayaddayadda chatter chatter chatter.</dd>
</dl>
</body>
</html>

Gives:

  • Item 1

    Lots of stuff about Item 1. blahblah blah yakyakyaketcetcetc yaddayaddayadda chatter chatter chatter. blahblah blah yakyakyaketcetcetc yaddayaddayadda chatter chatter chatter.

  • Item 2

    Lots of stuff about Item 2. blahblah blah yakyakyaketcetcetc yaddayaddayadda chatter chatter chatter. blahblah blah yakyakyaketcetcetc yaddayaddayadda chatter chatter chatter.

Back to the project Index.


Bookmark on your Personal Space


Conversations About This Entry

There are no Conversations for this Entry

Entry

A835193

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Written by

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more