martin2k

How HTML Works - Attributes and Values; Text; Comments

HomeForumTutorials Tags:
 
 

Attributes and Values

Attributes are used to change the effect of many of the tags used in HTML.  They are placed in the opening tag before the '>' character and separated from the tag name and each other with space characters.

In order to get the desired effect from the attribute, you must set its value.  Not all attributes require values, however.  To specify the value, a equals ('=') character is placed immediately after the attribute name and enclosed in quote characters ('"').  E.g.:

<font face="Times New Roman" color="yellow">This text will be in the font 'Times New Roman' and coloured yellow</font>

Which generates:

This text will be in the font 'Times New Roman' and coloured yellow

Not all attributes have to be set for a tag - the FONT tag also has the SIZE attribute.  If attributes are omitted, the default values will be used instead.  As stated above, not all attributes have values e.g.:

<button disabled>A disabled button</button>

Which generates:

Have a look a few of the tags from the dropdown list above to see what attributes they use, as well as the examples.

Text

Text is placed either outside of any open tags (with the exception of BODY) or it can be formatted with the many formatting tags that are available.

To start a new paragraph, enter text after an opening P tag.  To enter a line break, use the BR tag (which has no closing tag).

Tags such as H1-H6, FONT, B, I, U etc. allow you to change the appearance of text.  See the Tag Reference for more information.

Special Characters

There are several codes, which can be entered into text to produce special characters.  Here are some of the common ones:

Code Description
&nbsp; Enters a space character (non-breaking space).  It is not possible to render more than one consecutive space without using this code.
&amp; Ampersand - '&'
&quot; Quote - '"'
&lt; Less than - '<'
&gt; Greater than - '>'
&copy; Copyright - '©'

A full list can be found here: http://www.frontier.iarc.uaf.edu:8080/~cswingle/misc/all_html_codes.phtml

Comments

When writing HTML manually, it is useful to comment your code as you would when using a programming language.  To add a comment into your code, it must be entered after "<!--" and before "-->" e.g.:

<!--Comment-->


Previous - Introduction; Tags Next - Creating a Simple Web Page

Comments

From: james
Date: Friday, February 9, 2007 at 06:49:08
Comments: very good information gives about html tags

Please fill in the below form if you have any comments or additional information you want to add about the above information.  If you have any questions, please visit the ForumAny questions sent using this form will be ignored.

* - Mandatory

*Name: E-mail:

*Comments:

*Please type the following code (your comment cannot be accepted without it):


© Martin Allen 1999 - 2006.  Last updated Sunday 12 November 2006 07:44:36 PM -0000.