HTML

Home

Tutorials

Go to tag:

 

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="green">This text will be in the font 'Times New Roman' and coloured green</font>

Which generates:

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

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: https://dev.w3.org/html5/html-author/charref

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-->




Archived Comments

From: seszer
Date: Monday, July 14, 2008 at 19:23:51
Comments: Html Attribute for <MARQUEE ...> -- Marquee Slide Image and Text ---
http://html-lesson.blogspot.com/2008/06/marquee-slide-image-text.html
 
From: james
Date: Friday, February 9, 2007 at 06:49:08
Comments: very good information gives about html tags
© Martin Allen 1999 - 2017.  Last updated Thursday 16 November 2017 11:11 +0000.