Quantcast
Viewing all articles
Browse latest Browse all 10

HTML Tags and Attributes

Tags and Attributes


Tags

All HTML elements are built using tags. So what are tags? They are keywords, specified in the corresponding HTML standard, surrounded with angle brackets (<>). Most tags come in pairs – an opening tag and a closing tag. The closing tag includes a slash (/) in the beginning. Below you can see an opening and closing html tag which surround all content in an HTML document.

1
<html></html>

There are a few tags which do not come in pairs. The correct way of writing such tags is to include a slash (/) after the keyword. Below is the correct way of writing a line break tag br.

1
<br />

A full list of HTML tags can be found in the [tag list reference][html/html-tag-list].

Attributes

Each HTML element may have additional information associated with it via the use of attributes.

Attribute structure

  • Each attribute of an element is a name-value pair; the value should be quoted.
  • Multiple attributes can be specified for a single element. In such a case name-value pairs are separated with spaces.
  • The list of attribute is specified in the opening tag.
1
<h1 id="main-title">Programming Guides</h1>

In the example above id="main-title" is an attribute of the h1 element.

You can view a full list of valid attributes in the [attributes list][html/html-attribute-list]


Viewing all articles
Browse latest Browse all 10

Trending Articles