HTML5 - SPLessons

HTML5 Syntax

Chapter 3

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

HTML5 Syntax

HTML5 Syntax

shape Introduction

Current chapter demonstrate about the HTML5 Syntax. All the versions of HTML have same syntax and is also compatible with the XHTML. Following are the topics covered in HTML5 Syntax chapter.

  • HTML5 Syntax
  • HTML5 Elements

HTML5 Syntax

shape Description

HTML5 Syntax demonstrates the difference between the HTML and XML Syntax. HTML5 evolved with more flexibility.Here there is no need to worry about the Upper case tag names and closing empty elements are optional following are the some syntaxes.

  • Doctype
    The Doctype tag in HTML5 is a case sensitive as shown below.
    Syntax

    <!DOCTYPE html>
    
  • Character Encoding
    The Character Encoding tag in HTML5 is a case sensitive as shown below.
    Syntax

    <meta charset="UTF-8">
    
  • Character Encoding
    HTML5 demonstrate syntax for the Character Encoding. Which is a case sensitive as shown in below.
    Syntax

    <meta charset="UTF-8">
    
  • Link tag
    HTML5 demonstrate link tag as shown in below.
    Syntax

    <link rel="stylesheet" href="stylefile.css">
    
  • Script Tag
    HTML5 demonstrate Script tag for the Java Script as shown in below.
    Syntax

    <script src="scriptfile.js"></script>


HTML5 Elements

shape Description

HTML5 have the so many elements in order to develop the web pages. Elements always have the starting tag and the ending tag.The content should be written in between the tags. Following are some of the elements in HTML5

Syntax

<tagname>Content</tagname>
Tag Description
<head> head tag contains general information of the document.
<title> Which contains title of the document.
<meta> meta tag contains the meta information. Which is not displayed on the web browser.
<base> base tag contains the base URL for all relative links in a document.
<address> address tag contains corresponding address of the element.
<article> The article element contains an independent piece of document like blog entry or news paper article.
<header> header contains set of navigational links.
<nav> nav tag means Navigation tag which is used to go to the next page or skip over the page.
<section> section tag defines section of the document, such as header,footer or any other sections which is placed inside the body.
<p> paragraph tag is used to add the content to a web page in a paragraph manner. and with p element browser add some spaces and margins automatically.
<main> main tag is used to represents main text of the document.
<div> div tag defines a section of elements in a html document.
<link> link tag will used create the relationship between current document and external source.
<li> li defines list of items which contain ordered list and unordered list.
<footer> footer tag contains the footer section which contain copy rights information or author information etc.
<dl> dl tag defines definiton list tag.
<hr> hr tag defines Horizontal rules.
<sub> sub tag defines subscript text.

Summary

shape Points

  • HTML element must contain starting tag and ending tag.
  • HTML syntaxes are compatible with the XHTML syntaxes.
  • HTML elements can be nested elements.
  • HTML elements without any content are known as empty elements.