Monday, 13 June 2016

HTML strong tag


HTML: <strong> tag

This HTML tutorial explains how to use the HTML element called the <strong> tag with syntax and examples.

Description

The HTML <strong> tag gives text a strong emphasis which traditionally means that the text is displayed as bold by the browser. This tag is also commonly referred to as the <strong> element.

Syntax

In HTML, the syntax for the <strong> tag is:
<body>
<p><strong>Emphasized text goes here</strong></p>
</body>

Attributes

Only the Global Attributes apply to the <strong> tag. There are no attributes that are specific to the <strong> tag.

Note

  • The HTML <strong> element is found within the <body> tag.
  • The <strong> tag is used to separate the text from the rest of the content. Browsers traditionally bold the text found within the <strong> tag. You can change this behavior with CSS.

Browser Compatibility

The <strong> tag has basic support with the following browsers:
  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • IE Phone
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the <strong> tag below, exploring examples of how to use the <strong> tag in HTML 5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.

HTML 5 Document

If you created a new web page in HTML 5, your <strong> tag might look like this:
<!doctype html>
<html>

<head>
<meta charset="UTF-8">
<title>HTML 5 Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>We want to emphasize <strong>this text</strong>.</p>
</body>
</html>
In this HTML 5 Document example, we have created a <strong> tag that encloses the text "this text". Your browser, by default, will display "this text" as bolded text. You can overwrite this behavior with CSS.

HTML 4.01 Transitional Document

If you created a new web page in HTML 4.01 Transitional, your <strong> tag might look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTML 4.01 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>We want to emphasize <strong>this text</strong>.</p>
</body>
</html>
In this HTML 4.01 Transitional Document example, we have created a <strong> tag that encloses the text "this text". Your browser, by default, will display "this text" as bolded text. You can overwrite this behavior with CSS.

XHTML 1.0 Transitional Document

If you created a new web page in XHTML 1.0 Transitional, your <strong> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHMTL 1.0 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>We want to emphasize <strong>this text</strong>.</p>
</body>
</html>
In this XHTML 1.0 Transitional Document example, we have created a <strong> tag that encloses the text "this text". Your browser, by default, will display "this text" as bolded text. You can overwrite this behavior with CSS.

XHTML 1.0 Strict Document

If you created a new web page in XHTML 1.0 Strict, your <strong> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.0 Strict Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>We want to emphasize <strong>this text</strong>.</p>
</body>
</html>
In this XHTML 1.0 Strict Document example, we have created a <strong> tag that encloses the text "this text". Your browser, by default, will display "this text" as bolded text. You can overwrite this behavior with CSS.

XHTML 1.1 Document

If you created a new web page in XHTML 1.1, your <strong> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.1 Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>We want to emphasize <strong>this text</strong>.</p>
</body>
</html>
In this XHTML 1.1 Document example, we have created a <strong> tag that encloses the text "this text". Your browser, by default, will display "this text" as bolded text. You can overwrite this behavior with CSS.

HTML em tag


HTML: <em> tag

This HTML tutorial explains how to use the HTML element called the <em> tag with syntax and examples.

Description

The HTML <em> tag marks text that has stress emphasis which traditionally means that the text is displayed in italics by the browser. This tag is also commonly referred to as the <em> element.

Syntax

In HTML, the syntax for the <em> tag is:
<body>
<p><em>Stress emphasized text goes here</em></p>
</body>

Attributes

Only the Global Attributes apply to the <em> tag. There are no attributes that are specific to the <em> tag.

Note

  • The HTML <em> element is found within the <body> tag.
  • The <em> tag is used to separate the text from the rest of the content. Browsers traditionally italicize the text found within the <em> tag. You can change this behavior with CSS.

Browser Compatibility

The <em> tag has basic support with the following browsers:
  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • IE Phone
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the <em> tag below, exploring examples of how to use the <em> tag in HTML 5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.

HTML 5 Document

If you created a new web page in HTML 5, your <em> tag might look like this:
<!doctype html>
<html>

<head>
<meta charset="UTF-8">
<title>HTML 5 Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>We want to stress emphasize <em>this text</em>.</p>
</body>
</html>
In this HTML 5 Document example, we have created an <em> tag that encloses the text "this text". Your browser, by default, will display "this text" as italicized text. You can overwrite this behavior with CSS.

HTML 4.01 Transitional Document

If you created a new web page in HTML 4.01 Transitional, your <em> tag might look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTML 4.01 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>We want to stress emphasize <em>this text</em>.</p>
</body>
</html>
In this HTML 4.01 Transitional Document example, we have created an <em> tag that encloses the text "this text". Your browser, by default, will display "this text" as italicized text. You can overwrite this behavior with CSS.

XHTML 1.0 Transitional Document

If you created a new web page in XHTML 1.0 Transitional, your <em> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHMTL 1.0 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>We want to stress emphasize <em>this text</em>.</p>
</body>
</html>
In this XHTML 1.0 Transitional Document example, we have created an <em> tag that encloses the text "this text". Your browser, by default, will display "this text" as italicized text. You can overwrite this behavior with CSS.

XHTML 1.0 Strict Document

If you created a new web page in XHTML 1.0 Strict, your <em> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.0 Strict Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>We want to stress emphasize <em>this text</em>.</p>
</body>
</html>
In this XHTML 1.0 Strict Document example, we have created an <em> tag that encloses the text "this text". Your browser, by default, will display "this text" as italicized text. You can overwrite this behavior with CSS.

XHTML 1.1 Document

If you created a new web page in XHTML 1.1, your <em> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.1 Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>We want to stress emphasize <em>this text</em>.</p>
</body>
</html>
In this XHTML 1.1 Document example, we have created an <em> tag that encloses the text "this text". Your browser, by default, will display "this text" as italicized text. You can overwrite this behavior with CSS.

HTML p tag


HTML: <p> tag

This HTML tutorial explains how to use the HTML element called the <p> tag with syntax and examples.

Description

The HTML <p> tag defines a paragraph in the HTML document. This tag is also commonly referred to as the <p> element.

Syntax

In HTML, the syntax for the <p> tag is:
<body>
<p>The paragraph goes here.</p>
</body>

Attributes

In addition to the Global Attributes, the following is a list of attributes that are specific to the <p> tag:
AttributeDescriptionHTML Compatibility
alignAlignment of the textObsolete in HTML5, use CSS

Note

  • The HTML <p> element is found within the <body> tag.
  • It is the most commonly used block-level element.
  • Paragraphs defined with the <p> tag have extra spacing before and after the <p> tag.

Browser Compatibility

The <p> tag has basic support with the following browsers:
  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • IE Phone
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the <p> tag below, exploring examples of how to use the <p> tag in HTML 5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.

HTML 5 Document

If you created a new web page in HTML 5, your <p> tag might look like this:
<!doctype html>
<html>

<head>
<meta charset="UTF-8">
<title>HTML 5 Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>This is the first paragraph that would appear under Heading 1.</p>
<p>This is the second paragraph.</p>
</body>
</html>
In this HTML 5 Document example, we have created two <p> tags that appear under the <h1> tag.

HTML 4.01 Transitional Document

If you created a new web page in HTML 4.01 Transitional, your <p> tag might look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTML 4.01 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>This is the first paragraph that would appear under Heading 1.</p>
<p>This is the second paragraph.</p>
</body>
</html>
In this HTML 4.01 Transitional Document example, we have created two <p> tags that appear under the <h1> tag.

XHTML 1.0 Transitional Document

If you created a new web page in XHTML 1.0 Transitional, your <p> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHMTL 1.0 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>This is the first paragraph that would appear under Heading 1.</p>
<p>This is the second paragraph.</p>
</body>
</html>
In this XHTML 1.0 Transitional Document example, we have created two <p> tags that appear under the <h1> tag.

XHTML 1.0 Strict Document

If you created a new web page in XHTML 1.0 Strict, your <p> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.0 Strict Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>This is the first paragraph that would appear under Heading 1.</p>
<p>This is the second paragraph.</p>
</body>
</html>
In this XHTML 1.0 Strict Document example, we have created two <p> tags that appear under the <h1> tag.

XHTML 1.1 Document

If you created a new web page in XHTML 1.1, your <p> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.1 Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>This is the first paragraph that would appear under Heading 1.</p>
<p>This is the second paragraph.</p>
</body>
</html>
In this XHTML 1.1 Document example, we have created two <p> tags that appear under the <h1> tag.

HTML h1 tag


HTML: <h1> tag

This HTML tutorial explains how to use the HTML element called the <h1> tag with syntax and examples.

Description

The HTML <h1> tag defines the highest level or most important heading in the HTML document. This tag is also commonly referred to as the <h1> element.

Syntax

In HTML, the syntax for the <h1> tag is:
<body>
<h1>Heading 1 goes here</h1>
</body>

Attributes

In addition to the Global Attributes, the following is a list of attributes that are specific to the <h1> tag:
AttributeDescriptionHTML Compatibility
alignAlignment of the textDeprecated in HTML 4.01, Obsolete in HTML5, use CSS

Note

  • The HTML <h1> element is found within the <body> tag.
  • Headings can range from <h1> to <h6>. The most important heading is <h1> and the least important heading is <h6>.
  • The <h1> heading is the first heading in the document.
  • The <h1> heading is usually a large bolded font.
  • Do not use a <h1> tag simply to apply different formatting. <h1> tags are used to define heading levels, like in a Table of Contents.

Browser Compatibility

The <h1> tag has basic support with the following browsers:
  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • IE Phone
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the <h1> tag below, exploring examples of how to use the <h1> tag in HTML 5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.

HTML 5 Document

If you created a new web page in HTML 5, your <h1> tag might look like this:
<!doctype html>
<html>

<head>
<meta charset="UTF-8">
<title>HTML 5 Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>This is the content that would appear under Heading 1.</p>
</body>
</html>
In this HTML 5 Document example, we have created the <h1> tag with the text "Heading 1".

HTML 4.01 Transitional Document

If you created a new web page in HTML 4.01 Transitional, your <h1> tag might look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTML 4.01 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>This is the content that would appear under Heading 1.</p>
</body>
</html>
In this HTML 4.01 Transitional Document example, we have created the <h1> tag with the text "Heading 1".

XHTML 1.0 Transitional Document

If you created a new web page in XHTML 1.0 Transitional, your <h1> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHMTL 1.0 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>This is the content that would appear under Heading 1.</p>
</body>
</html>
In this XHTML 1.0 Transitional Document example, we have created the <h1> tag with the text "Heading 1".

XHTML 1.0 Strict Document

If you created a new web page in XHTML 1.0 Strict, your <h1> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.0 Strict Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>This is the content that would appear under Heading 1.</p>
</body>
</html>
In this XHTML 1.0 Strict Document example, we have created the <h1> tag with the text "Heading 1".

XHTML 1.1 Document

If you created a new web page in XHTML 1.1, your <h1> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.1 Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading 1</h1>
<p>This is the content that would appear under Heading 1.</p>
</body>
</html>
In this XHTML 1.1 Document example, we have created the <h1> tag with the text "Heading 1".

HTML body tag


HTML: <body> tag

This HTML tutorial explains how to use the HTML element called the <body> tag with syntax and examples.

Description

The HTML <body> tag defines the main content of the HTML document or the section of the HTML document that will be directly visible on your web page. This tag is also commonly referred to as the <body> element.

Syntax

In HTML, the syntax for the <body> tag is:
<body>
</body>

Attributes

In addition to the Global Attributes, the following is a list of attributes that are specific to the <bpdy> tag:
AttributeDescriptionHTML Compatibility
alignColor of text for selected hyperlinksDepreciated in HTML 4.01, Obsolete in HTML 5, use CSS
backgroundImage to be used a backgroundDepreciated in HTML 4.01, Obsolete in HTM L5, use CSS
bgcolorBackground colorDepreciated in HTML 4.01, Obsolete in HTML 5, use CSS
linkColor of text for unvisited hyperlinksDepreciated in HTML 4.01, Obsolete in HTML 5, use CSS
onafterprintFunction to call user has printed documentHTML 5
onbeforeprintFunction to call when user requests document to be printedHTML 5
onbeforeunloadFuntion to call when document is to be unloadedHTML 5
onblurFunction to call when document has lost focusHTML 5
onerrorFunction to call when document failsHTML 5
onfocusFunction to call when document has focusHTML 5
onhaschangeFunction to call when fragment identifier portion of document's address has changedHTML 5
onloadFunction to call when document has loadedHTML 5
onmessageFunction to call when the document received a messageHTML 5
onofflineFunction to call when Network communication failsHTML 5
ononlineFunction to call when Network communication is restoredHTML 5
onpopstateFunction to call when user navigated session historyHTML 5
onredoFunction to call when user moved forward in undo historyHTML 5
onresizeFunction to call when document was resizedHTML 5
onstorageFunction to call when storage area changedHTML 5
onundoFunction to call when user moved backward in undo historyHTML 5
onunloadFunction to call when document is being unloadedHTML 5
textForeground color of textDepreciated in HTML 4.01, Obsolete in HTML 5, use CSS
vlinkColor of text for visited hyperlinksDepreciated in HTML 4.01, Obsolete in HTML 5, use CSS

Note

  • The HTML <body> element is found within the <html> tag.
  • The most common elements to be placed in the HTML <body> tag are: <h1><p><div><table> tags.

Browser Compatibility

The <body> tag has basic support with the following browsers:
  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • IE Phone
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the <body> tag below, exploring examples of how to use the <body> tag in HTML 5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.

HTML 5 Document

If you created a new web page in HTML 5, your <body> tag might look like this:
<!doctype html>
<html>

<head>
<meta charset="UTF-8">
<title>HTML 5 Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading</h1>
<p>This is the content.</p>
</body>
</html>
In this HTML 5 Document example, the <body> tag contains two elements - a heading found in the <h1> tag and a paragraph found in the <p> tag.

HTML 4.01 Transitional Document

If you created a new web page in HTML 4.01 Transitional, your <body> tag might look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTML 4.01 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading</h1>
<p>This is the content.</p>
</body>
</html>
In this HTML 4.01 Transitional Document example, the <body> tag contains two elements - a heading found in the <h1> tag and a paragraph found in the <p> tag.

XHTML 1.0 Transitional Document

If you created a new web page in XHTML 1.0 Transitional, your <body> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.0 Transitional Example</title>
</head>

<body>
<h1>Heading</h1>
<p>This is the content.</p>
</body>
</html>
In this XHTML 1.0 Transitional Document example, the <body> tag contains two elements - a heading found in the <h1> tag and a paragraph found in the <p> tag.

XHTML 1.0 Strict Document

If you created a new web page in XHTML 1.0 Strict, your <body> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.0 Strict Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading</h1>
<p>This is the content.</p>
</body>
</html>
In this XHTML 1.0 Strict Document example, the <body> tag contains two elements - a heading found in the <h1> tag and a paragraph found in the <p> tag.

XHTML 1.1 Document

If you created a new web page in XHTML 1.1, your <body> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.1 Example by www.techonthenet.com</title>
</head>

<body>
<h1>Heading</h1>
<p>This is the content.</p>
</body>
</html>
In this XHTML 1.1 Document example, the <body> tag contains two elements - a heading found in the <h1> tag and a paragraph found in the <p> tag.

HTML title tag


HTML: <title> tag

This HTML tutorial explains how to use the HTML element called the <title> tag with syntax and examples.

Description

The HTML <title> tag contains the title of the document which displays at the top of the browser window or is used as the Bookmark name when adding a web page to your Favorites. This tag is also commonly referred to as the <title> element.

Syntax

In HTML, the syntax for the <title> tag is:
<head>
<title>Place your document title here</title>
</head>

Attributes

Only the Global Attributes apply to the <title> tag. There are no attributes that are specific to the <title> tag.

Note

  • The HTML <title> element is found within the <head> tag.
  • You MUST include the <title> tag within the <head> tag in your document.
  • If you do NOT include the <title> tag within the <head> tag, you will receive the following error when validating your HTML: "Element head is missing a required instance of child element title."

Browser Compatibility

The <title> tag is compatible with the following browsers:
  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • IE Phone
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the <title> tag below, exploring examples of how to use the <title> tag in HTML 5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.

HTML 5 Document

If you created a new web page in HTML 5, your <title> tag might look like this:
<!doctype html>
<html>

<head>
<meta charset="UTF-8">
<title>HTML 5 Example by www.techonthenet.com</title>
</head>

<body>
</body>
</html>
In this HTML 5 Document example, we have created a title called "HTML 5 Example".

HTML 4.01 Transitional Document

If you created a new web page in HTML 4.01 Transitional, your <title> tag might look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTML 4.01 Transitional Example by www.techonthenet.com</title>
</head>

<body>
</body>
</html>
In this HTML 4.01 Transitional Document example, we have created a title called "HTML 4.1 Transitional Example".

XHTML 1.0 Transitional Document

If you created a new web page in XHTML 1.0 Transitional, your <title> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHMTL 1.0 Transitional Example by www.techonthenet.com</title>
</head>

<body>
</body>
</html>
In this XHTML 1.0 Transitional Document example, we have created a title called "XHTML 1.0 Transitional Example".

XHTML 1.0 Strict Document

If you created a new web page in XHTML 1.0 Strict, your <title> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.0 Strict Example by www.techonthenet.com</title>
</head>

<body>
</body>
</html>
In this XHTML 1.0 Strict Document example, we have created a title called "XHTML 1.0 Strict Example".

XHTML 1.1 Document

If you created a new web page in XHTML 1.1, your <title> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>XHTML 1.1 Example by www.techonthenet.com</title>
</head>

<body>
</body>
</html>
In this XHTML 1.1 Document example, we have created a title called "XHTML 1.1 Example".

HTML script tag


HTML: <script> tag

This HTML tutorial explains how to use the HTML element called the <script> tag with syntax and examples.

Description

The HTML <script> tag is used to embed or reference a client-side script such as JavaScript. This tag is also commonly referred to as the <script> element.

Syntax

There are two ways that you can use the <script> tag. You can either embed the code within the <script> tags or you can reference a file that includes the code.

Embedded Code

In HTML, the syntax for the <script> tag that has embedded code within the <script> tag is:
<script type="text/javascript">
  client-side scripting goes here ...
</script>

Reference a File

In HTML, the syntax for the <script> tag that references a javascript file is:
<script src="/js/functions.js" type="text/javascript"></script>

Attributes

In addition to the Global Attributes, the following is a list of attributes that are specific to the <script> tag:
AttributeDescriptionHTML Compatibility
asyncBoolean value to indicate whether browser should execute script asynchronouslyHTML 5
srcURI of the external scriptHTML 4.01, HTML 5
typeScripting language of the code. Can be one of the following values:
  • text/javascript
  • text/ecmascript
  • application/javascript
  • application/ecmascript
HTML 4.01 (Not required in HTML 5)
languageScripting language. Use type instead.Deprecated
deferBoolean value to indicate whether script is executed after document has been parsedHTML 4.01, HTML 5

Note

Browser Compatibility

The <script> tag has basic support with the following browsers:
  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • IE Phone
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the <script> tag below, exploring examples of how to use the <script> tag in HTML 5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.

HTML 5 Document

If you created a new web page in HTML 5, your <script> tag might look like this:
<!doctype html>
<html>

<head>
<meta charset="UTF-8">
<script src="/js/functions.js"></script>
<title>HTML 5 Example by www.techonthenet.com</title>
</head>

<body>
<script>
  document.write("HTML 5 Script Tag Example");
</script>
</body>
</html>
In this HTML 5 Document example, we have used the <script> tag within the <head> tag to reference a javascript file called functions.js. We have also used the <script> tag within the <body> tag to print the text "HTML 5 Script Tag Example".
Notice that in the HTML 5 Document example that type="text/javascript" is not required in the <script> tag.

HTML 4.01 Transitional Document

If you created a new web page in HTML 4.01 Transitional, your <script> tag might look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="/js/functions.js" type="text/javascript"></script>
<title>HTML 4.01 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<script type="text/javascript">
  document.write("HTML 4.01 Transitional Script Tag Example");
</script>
</body>
</html>
In this HTML 4.01 Transitional Document example, we have used the <script> tag within the <head> tag to reference a javascript file called functions.js. We have also used the <script> tag within the <body> tag to print the text "HTML 4.01 Transitional Script Tag Example".

XHTML 1.0 Transitional Document

If you created a new web page in XHTML 1.0 Transitional, your <script> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="/js/functions.js" type="text/javascript"></script>
<title>XHMTL 1.0 Transitional Example by www.techonthenet.com</title>
</head>

<body>
<script type="text/javascript">
  document.write("HTML XHTML 1.0 Transitional Script Tag Example");
</script>
</body>
</html>
In this XHTML 1.0 Transitional Document example, we have used the <script> tag within the <head> tag to reference a javascript file called functions.js. We have also used the <script> tag within the <body> tag to print the text "XHTML 1.0 Transitional Script Tag Example".

XHTML 1.0 Strict Document

If you created a new web page in XHTML 1.0 Strict, your <script> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="/js/functions.js" type="text/javascript"></script>
<title>XHTML 1.0 Strict Example by www.techonthenet.com</title>
</head>

<body>
<script type="text/javascript">
  document.write("HTML XHTML 1.0 Strict Script Tag Example");
</script>
</body>
</html>
In this XHTML 1.0 Strict Document example, we have used the <script> tag within the <head> tag to reference a javascript file called functions.js. We have also used the <script> tag within the <body> tag to print the text "XHTML 1.0 Strict Script Tag Example".

XHTML 1.1 Document

If you created a new web page in XHTML 1.1, your <script> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="/js/functions.js" type="text/javascript"></script>
<title>XHTML 1.1 Example by www.techonthenet.com</title>
</head>

<body>
<script type="text/javascript">
  document.write("HTML XHTML 1.1 Script Tag Example");
</script>
</body>
</html>
In this XHTML 1.1 Document example, we have used the <script> tag within the <head> tag to reference a javascript file called functions.js. We have also used the <script> tag within the <body> tag to print the text "XHTML 1.1 Script Tag Example".