HTML5 > Elements of HTML

Div in HTML5

How to display division (section) in the html content?


<div> tag is used to group block elements in html page. It can be also used to sepecify certain css style to its containing elements or content.

CODE 
This is normal text.
 <div style="color:red"> 
  <h3>This is a header inside div</h3>  
 <p>This is a paragraph inside div.</p>
 </div> 

In the above code snippet, h3 and p element is wrapped inside div tag that is a division from the rest of the content of the page.

Output

The style applied in the div gets applied to all text inside the div.

 Views: 1156 | Post Order: 7



Write for us