HTML Elements

The HTML Elements

HTML document is built using elements. Elements are the bricks that create the structure that hold a web page together. Elements give structure to html document and tells the browser how you want your website to be displayed, for example, a <p> informs the browser to make a paragraph <h1> for heaning 1 just like word processing.

Element Syntax

html tags

Example of HTML Tags in my website:

html tags

Attributes

Attributes are always written within a start tag and are followed by an equals sign and the attribute details written between the double quotes (“attribute name”). The semicolon after the attribute is for separating different style commands.

Example:

<a href=“http://www.desena.com.au”>Desena web design<⁄a> Href is the name of the attributes and the http://www.desena.com.au is the value of the attributes. Attribute values should always be enclosed in double quotes.

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). Horizontal rule <hr ⁄>. Images - <img src=”eric.jpg” alt=”eric” width=”300” height=”250” ⁄>, meta element is also a self-closing element.

All HTML elements must be closed. Adding a slash inside the start tag, like <p⁄>, is the proper way of closing empty elements in HTML.