Home arrow HTML arrow HTML Formatting and Colors
HTML

HTML Formatting and Colors


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.

Author Info:
By: James Payne
Rating: 5 stars5 stars5 stars5 stars5 stars / 8
January 15, 2008
TABLE OF CONTENTS:
  1. · HTML Formatting and Colors
  2. · Quotation, Acronyms, And More
  3. · Writing Backwards
  4. · Handing Out Citations
  5. · Background
  6. · Color Code Chart

print this article
SEARCH DEVARTICLES

HTML Formatting and Colors
(Page 1 of 6 )

Last article I showed you a table with some text formatting. Here is another table displaying even more ways to format text:

 

Tag

What it Does

Example

Result

<code>

Creates computer code text

<code>Hello</code>

Hello

<kbd>

Creates keyboard text

<kbd>Hello</kbd>

Hello

<samp>

Creates sample computer code text

<samp>Hello</samp>

Hello

<var>

Creates variable text

<var>Hello</var>

Hello

<pre>

Creates Preformatted text, which does not delete text or line breaks created by the user without tags.

<pre>Hello how are you doing

good

friend</pre>

Hello how are

you doing

good

friend

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:


<html>

<body>


<p>This is an example of what happens to white

space and

line breaks in HTML </p>

</body>

</html>

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:


<html>

<body>


<pre>This is an example of what happens to white

space and

line breaks in HTML </pre>

</body>

</html>

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:

  This is an example of what happens to white

  space and

  line breaks in HTML


blog comments powered by Disqus
HTML ARTICLES

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials