HTML02: Syntax

A HTML source code consist of tags. THe syntax of a tag is

<tag>the content of the tag</tag>

a tag is written inside a pair of angle brackets, the opening angle bracket '<' and the closing angle bracket '>'. the tag on the front is called start tag. The tag at the back is called end tag. End tag has the forward slash. Anything written in between the start tag and end tag belongs to the specified tag.

the content of the tag may have multiple lines, so very often we would see

<tag>
  the content of the tag
  ...
</tag>

Common tags are <p> which denotes paragraph in a page, <h1> which denotes heading or <a> link to other pages or websites.

Following is a common structure of a HTML source code, this also can be used as template for all other source codes.

<html>

  <head>
    <title>Title in tab</title>
  </head>

  <body>
    <h1>Page title</h1>

    <p>
      A paragraph in this page
    </p>
  </body>

</html>


the entire source code is enclosed in side of <html> tag. Inside the <html> tag there are two major parts which: <head> and <body>. All the visible elements of the page is written in the <body> tag.

this will produce following output in a browser

Page title

A paragraph in this page...


the <h1> tag display the text in largest heading font size. Next the paragraph is enclosed in <p>.

The link opens a new page or web site when clicked. The URL or address of the destination the link heads to is written on href attribute. Each tag has attribute that allow us to specify how we want the tag to behave.

<html>
  <body>
    <a href = "www.google.com">Link to google</a>
  </body>
</html>

this will produce following output:
 

A link will be displayed in blue color font with an underline, cursor changes to link pointer when the mouse cursor hovers over the link. When the link is clicked. browser will immediately opens the url given in the href attribute.


Comments

Popular posts from this blog

Drawing Simple Pie Chart

VB.net connecting to SQL Server

VB.net