HTML Elements : Body

The HTML document would start with <html> tag and end with </html> closing tag, apart from that it has two main elements :

  • Head
  • Body

Body :

The <body> tag defines the document's body. The body element contains all the contents of an HTML document, for example text, images, list, tables, hyperlinks,frames forms etc. Example :
<!DOCTYPE html>
<html>
	<head>
		 <title>Test Page</title>
   <head>	
   <body>
	 <p>Hello world!!</p>
	 <p>This is the Test Page</p>
	 <p>
   </body>
</html>

Some of the attributes of body element :

<a> : Defines the internal link, external link and Subdirectory link. Example :
<!DOCTYPE html>
<html>
	<head>
		 <title>Test Page</title>
	<head>	
   <body>
	 <p>Hello world!!</p>
	<a href="http://www.mycsnotes.com" target="_blank">Click here for Home Page</a>
   </body>
</html>

<br /> : The <br/> tag is use for break single line. Example :
<!DOCTYPE html>
<html>
	<head>
		 <title>Test Page</title>
	<head>	
   <body>
	 <p>Hi my name is John wick. <br /> And i work as a Freelance contractor.</p>
   </body>
</html>

<div> : The <div> tag defines the division section in a web document. Example :
<!DOCTYPE html>
<html>
	<head>
		 <title>Test Page</title>
	<head>	
   <body>
	<div id="demo">
	  <p> This is First paragraph </p>
	 <p>This is the test page For HTML.</p>
	</div>
   </body>
</html>

<form> : The form tag define the HTML form for use in input documents.
<!DOCTYPE html>
<html>
	<head>
		 <title>Test Page</title>
	<head>	
   <body>
	  <form action="form_process.php" method="post">
			<p>Username: <input type="text" name="username"/></p>
			<p>Password: <input type="password" name="password"/></p>
			<input type="submit" value="Send" />
	  </form>
</body>
</html>

<hr> : The <hr>tag defines the horizontal line. Example :
<!DOCTYPE html>
<html>
	<head>
		 <title>Test Page</title>
	<head>	
   <body>
	  <p> This is First paragraph </p>
	  <hr />
	 <p>This is the test page For HTML.</p>
   </body>
</html>

<p> : The <p> tag defines the paragraph in web documents.
<!DOCTYPE html>
<html>
	<head>
		 <title>Test Page</title>
	<head>	
   <body>
	 <p>This is the test page For HTML.</p>
   </body>
</html>

<table> : The <table> tag defines the table. Exmaple :
<!DOCTYPE html>
<html>
	<head>
		 <title>Test Page</title>
	<head>	
   <body>
<table style="width:100%">
  <tr>
	<th>Firstname</th>
	<th>Lastname</th> 
    
  </tr>
  <tr>
	<td>John</td>
	<td>Wick</td> 
  </tr>
  <tr>
	<td>Jack</td>
	<td>ritcher</td> 
  </tr>
</table>
   </body>
</html>





Next Topic :