HTML Elements

HTML files contains HTML elements. These HTML elements describes exactly how your web page will look like and how it can be used. The order of the elements in your HTML file tells your web browser which data will be displayed first.

An HTML element is everything from HTML start tag to HTML end tag. Data between the start tag and end tag is called the element content.

SYNTAX:
<start tag> element content </end tag>

EXAMPLE:

HTML Element Output in web browser
<p>This is a paragraph</p> This is a paragraph
<b> This text is bold</b> This text is bold
<b><i>Bold and italic</i></b> Bold and italic
<br/>
<a href=”http://www.milkshakewebdesign.com”> a link</a> a link

Example explanation:

  • An HTML element consist of a start/opening tag, an element content and an end/closing tag
  • An HTML element starts with opening/start tag
  • An HTML element starts with closing/end tag
  • There are elements that do not need element content and these elements are closed at the start tag (i.e. <br/>)
  • An HTML can have attributes

HTML Attributes

HTML attributes provides information on how HTML tags will behave. An attribute is denoted by a name and is followed by “=” sign and then an assigned value. The assigned value should be enclosed with a double quote (“assigned_value”).http://www.milkshakewebdesign.com/html-tutorial/how-to-create-an-html-file/

SYNTAX:

<start_tag attrbute_name=”attribute value”> element content </end tag>

EXAMPLE:

<a href=”http://www.milkshakewebdesign.com”> Milkshake.com </a>

Example explanation:

We used the <a> tag to create a link to Milkshake.com. The “href” is an attribute name for the <a> tag that indicates the link to Milkshake.com. The link “http://www.milkshakewebdesign.com” served as the attribute value. The <a> tag and </a> tag were used as the opening and closing tag respectively.