HTML Elements

An HTML element is defined by a start tag, some content, and an end tag. An HTML element is defined by a start tag, some content, and an end tag:

Note that some HTML elements have no content (like the <br> element). These elements are called empty elements. Empty elements do not have an end tag. For the tags that require end tags you must not forget their end tags or else elements will not display correctly.

HTML elements can be nested which means that elements can contain other elements. HTML tags are not case sensitive: <P> means the same as <p>.

Headings

HTML headings are titles or subtitles that you want to display on a webpage. HTML headings are defined with the <h1> to <h6> tags. <h1> defines the most important heading. <h6> defines the least important heading. Browsers automatically add some white space (a margin) before and after a heading.

Search engines use the headings to index the structure and content of your web pages. Users often skim a page by its headings. It is important to use headings to show the document structure. <h1> headings should be used for main headings, followed by <h2> headings, then the less important <h3>, and so on. Use HTML headings for headings only. Don’t use headings to make text BIG or bold.

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

Each HTML heading has a default size. However, you can specify the size for any heading with the style attribute, using the CSS font-size property

<h1 style="font-size:160px;">Heading 1</h1>

 

Paragraph

The HTML <p> element defines a paragraph. A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.

<p>My name is Folau.</p>

 

Link

The <a> tag defines a hyperlink, which is used to link from one page to another. The most important attribute of the <a> element is the href attribute, which indicates the link’s destination.

Features:

  • An unvisited link is underlined and blue
  • A visited link is underlined and purple
  • An active link is underlined and red
  • If the <a> tag has no href attribute, it is only a placeholder for a hyperlink.
  • A linked page is normally displayed in the current browser window, unless you specify another target.
  • Links can be styled to look like buttons.
<a href="index.html" target="_self">Go Home</a>

 

Image

The <img> tag is used to display an image in an HTML page. Images are not technically inserted into a web page; images are linked to web pages. The <img> tag creates a holding space for the referenced image.

The <img> tag has two required attributes:

  • src – Specifies the path to the image
  • alt – Specifies an alternate text for the image, if the image for some reason cannot be displayed

You need to always specify the width and height of an image. If width and height are not specified, the page might flicker while the image loads.

To link an image to another document, simply nest the <img> tag inside an <a> tag.

<img src="superman.jpg" alt="superman" width="500" height="600">

 

 

Block-Level Elements

A block-level element always starts on a new line and takes up the full width available. These are block-level elements:

<address><article><aside><blockquote><canvas><dd><div><dl><dt><fieldset><figcaption><figure><footer><form><h1>-<h6><header><hr><li><main><nav><noscript><ol><p><pre><section><table><tfoot><ul><video>

 

Inline Elements

An inline element does not start on a new line and it only takes up as much width as necessary. Note that an inline element cannot contain a block-level element.

<a><abbr><acronym><b><bdo><big><br><button><cite><code><dfn><em><i><img><input><kbd><label><map><object><output><q><samp><script><select><small><span><strong><sub><sup><textarea><time><tt><var>

 

Button

The <button> tag defines a clickable button. Inside a <button> element you can put text (and tags like <i>, <strong>, <br>, <img>, etc.). This is not possible with a button created with the <input> element.

You must always specify the type attribute for a <button> element, to tell browsers what type of button it is. You can easily style buttons to look like a link.

<button name="hello" type="button">Hello</button>

 

 

Footer

The <footer> tag defines a footer for a document or section.

<footer> tag contains:

  • authorship information
  • copyright information
  • contact information
  • sitemap
  • back to top links
  • related documents

You can have several <footer> elements in one document. 

<footer>
    <p>Author: Folau</p>
    <p><a href="mailto:folau@gmail.com">folau@gmail.com</a></p>
</footer>

 

Source code on Github




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

Your email address will not be published.