In our last tutorial we left off discussing some basic HTML formatting. In this episode we will continue our discussion of formatting and get into working with Entities. Thereís a lot to cover, so letís get busy.
Last article I showed you a table with some text formatting. Here is another table displaying even more ways to format text:
What it Does
Creates computer code text
Creates keyboard text
Creates sample computer code text
Creates variable text
Creates Preformatted text, which does not delete text or line breaks created by the user without tags.
<pre>Hello how are you doing
Hello how are
The above examples are used mostly to display examples of programming code, except the Preformatted tag <pre>, which is also used for formatting regular documents.
Consider this example:
<p>This is an example of what happens to white
line breaks in HTML </p>
This is what happens when this code is translated by an Internet browser:
This is an example of what happens to white space and line breaks in HTML
As you can see, if there is more than one space between words, HTML is courteous enough to delete it for you. To prevent this innate courteousness, you can use the Preformatted tag <pre>. Check out this code:
<pre>This is an example of what happens to white
line breaks in HTML </pre>
As you can see it is essentially the same text, except that I replaced the <p> tags with the <pre> tags. Here is how this new code will be interpreted by the browser: