Monday, February 23, 2015

Let's learn about the codes you've used to create a webpage

From the previous post you have learned to create a webpage using the codes given below. In this post you will learn detail about the codes/tag.
<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>iDhali</title>
 </head>
 <body>
  <h1>This is a Header</h1>
  <p>This is a Paragraph</p>
  <b>This is Bold Text</b>
  <i>This is Italic Text</i>
  <u>This is Underlined Text</u>
 </body>
</html>

<!DOCTYPE html>
The first line <!DOCTYPE html> is the doctype declaration. This line must be the very first line of an HTML document. This line will be before the opening tag <html> but <!DOCTYPE> itself is not an HTML tag. Basically <!DOCTYPE> declaration in an instruction for the web browsers that tells the browser in what version of HTML is used. The line <!DOCTYPE html> is used to define that the page is written in HTML 5.

<html>
The second line is <html lang="en">, that is an opening tag. That's why an closing tag </html> is used at the line number 14. Inside the opening <html> tag lang is an attribute what's value is en. lang="en" is used to tells the browser that the language of the html document will be English. You can use <html lang="bn"> for Bangla. <html> element is a container to hold all other HTML elements inside it.

N.B. For every opening tag a closing tag is must. Sometimes we will use some self closed tags like <br/>, <hr/> etc.

<head>
In the third line there is an <head> tag and another closing </head> tag is given at the line number 6. The <head> element is a container for all the head elements like <title>, <link>, <style>, <script>, <noscript>, <base> etc. When you will link an .css file (stylesheet), then the tag <link> will be used inside the <head> and </head> tags. Meta information, keywords, JavaScript etc. will also go inside the <head> and </head> tags.

<meta charset="UTF-8">
The fourth line is <meta charset="UTF-8"> where <meta> is an tag that provides metadata about the HTML document. Metadata will not be displayed on a page, but it is used to specify page description, keywords etc. charset is the short of Character Set that specify the character encoding for the HTML document.

<title>
The fifth line is <title>iDhali</title>. Inside the <title> and </title> tags what will keep will be displayed as the website title. For example iDhali is showing as the title of this page you are reading now.

<body>
In the 7th line there is an opening <body> tag and in the 13th line there is also a closing </body> tag. This is the main container of a webpage. The data and/or information given inside the <body> and </body> tags will be displayed on the webpage.

There are some HTML tags like <h1>, <p>, <b>, <i>, <u> and also CSS codes to format and/or beautify the content you want to show on the page. The tags used inside the <body> and </body> tags are described in the next tutorial briefly.

« Previous Tutorial
Next Tutorial »


No comments:

Post a Comment