Monday, July 23, 2018


HTML Key Components


HTML markup consists of several key components, including those called tags (and their attributes), character-based data types, character references and entity references. HTML tags most commonly come in pairs like <h1> and </h1>, although some represent empty elements and so are unpaired, for example <img>. The first tag in such a pair is the start tag, and the second is the end tag (they are also called opening tags and closing tags).

Another important component is the HTML document type declaration, which triggers standards mode rendering.

HTML Components (HTCs) are a legacy technology used to implement components in script as Dynamic HTML (DHTML) "behaviors" in the Microsoft Internet Explorer web browser. ... An HTC is typically an HTML file (with JScript / VBScript) and a set of elements that define the component.

The following is an example of the classic "Hello, World!" program:

<!DOCTYPE html>

<html>

  <head>
    <title>This is a title</title>
  </head>

  <body>
    <p>Hello world!</p>
  </body>

</html>

Output:



Document elements

Example Explained

  • The <html> element defines the whole document.


It has a start tag <html> and an end tag </html>.

  • The element content is another HTML element (the <body> element).
The <body> element defines the document body.


<html>

<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>

</html>

Output:



It has a start tag <body> and an end tag </body>.
The element content is two other HTML elements (<h1> and <p>).

<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>

Output:


  • The <h1> element defines a heading.


It has a start tag <h1> and an end tag </h1>.

The element content is: My First Heading.

<h1>My First Heading</h1>

Headings: HTML headings are defined with the <h1> to <h6> tags:

<h1>Heading level 1</h1>
<h2>Heading level 2</h2>
<h3>Heading level 3</h3>
<h4>Heading level 4</h4>
<h5>Heading level 5</h5>
<h6>Heading level 6</h6>

  • The <p> element defines a paragraph.


It has a start tag <p> and an end tag </p>.

The element content is: My first paragraph.

<p>My first paragraph.</p>

Do Not Forget the End Tag
Some HTML elements will display correctly, even if you forget the end tag:

Example

<html>
<body>

<p>This is a paragraph
<p>This is a paragraph

</body>

</html>

The example above works in all browsers, because the closing tag is considered optional.

Never rely on this. It might produce unexpected results and/or errors if you forget the end tag.

Empty HTML Elements
HTML elements with no content are called empty elements.

  • <br> is an empty element without a closing tag (the <br> tag defines a line break). 

Empty elements can be "closed" in the opening tag like this: <br />.

HTML5 does not require empty elements to be closed. But if you want stricter validation, or if you need to make your document readable by XML parsers, you must close all HTML elements properly.



Related Posts:

  • Characteristics Of HTML Language Characteristics Of HTML Language HTML is the most common used language to write web pages .It has recently gained popularity due to its advantages such as : - It is the language which can be easily understand and ca… Read More
  • HTML Attributes HTML Attributes attribute is used to define the characteristics of an HTML element and is placed inside the element's opening tag. All attributes are made up of two parts − a name and a value The name is the property… Read More
  • Limitations of HTML Limitations of HTML  HTML is also known as HyperText Markup Language provides the creation of the web pages.  The HTML pages are the documents that can be read by the server, and are not the best fit to b… Read More
  • HTML - Meta Tags HTML - Meta Tags HTML lets you specify metadata - additional important information about a document in a variety of ways. The META elements can be used to include name/value pairs describing properties of the HTML doc… Read More
  • Advantages and Disadvantages of HTML Advantages and Disadvantages of HTML points about HTML: HTML is used to create webpages. HTML used many tags to make a webpage. So it is a tag based language. The tags of HTML are surrounded by angular bracket. It … Read More

0 comments:

Post a Comment

Popular Posts