Specifying Element Attributes

This section describes how to specify element attributes in quoted text values, bare text values or minimization format.

Attributes are supported on HTML elements and they should be entered in one of these formats:

1. Attributes with Quoted Values - Attribute values are specified as quoted text strings. This is the recommended format. Here is a good example:

<img src="picture.jpg" alt="It's a boy!"/>

2. Attributes with Bare Values - Attribute values are specified as bare text strings. Here is a good example:

<img src=picture.jpg alt=Blue_Sky/>

The above format is not recommended. Use the format below:
<img src="picture.jpg"
 alt="Blue_Sky"/>

3. Attributes with no Explicit Values (Attribute Minimization) - Some Boolean attributes can be specified without explicitly providing any values. Here is a good example:

<button type="button" disabled>Try me later!</button>


The above format is not recommended. Use the format below:
<button type="button" disabled="disabled">Try me later!</button>

4. Attribute Name - HTML attribute names are case insensitive. For example, "src" and "SRC" are identical. It is strongly recommended that you always use lower case letters in attribute names.

5. Reserved Characters - When HTML reserved characters are part of attribute values, they must be replaced with their entity references listed below:

<   &lt;
>   &gt;
&   &amp;
"   &quot;

Table of Contents

 About This Book

 Introduction of HTML

 Introduction of HTML5 Features

 HTML Document Structure and Content

HTML Document and Elements Syntax

 HTML Document Syntax

 Document Character Set and Encoding

 Entering Comments in HTML Document

 Opening and Closing Tags of Elements

 Using Nested Elements

Specifying Element Attributes

 Specifying Element Contents

 Element Content Syntax Types

 Using Whitespace Characters

 Using Character Entity References

 Using Numeric Character References

 Displayed and Printed HTML Documents

 Responsive Design of Web Pages

 MathML Integration in HTML Documents

 References

 Full Version in PDF/EPUB