HTML:-Div tag

<!DOCTYPE html>
<html>

<head>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>div tag</title>
</head>

<body>

 <!--Div can be used to group elements-->
 <div>
  This is the First Div
  <input type="text">
  <input type="text">
  <input type="text">
 </div>

 <div>
  This is the Second Div
  <input type="text">
  <button>Sample Button</button>
 </div>

</body>

</html>.   Definition:-
<div> tag
  • This tag is nothing more than a container unit that encapsulates other page elements and divides the HTML document into sections.
  • Web developers use <div> elements to group together HTML elements and apply CSS styles to many elements at once.
  • Difference between <div> and <span> tag
     The <span> tag is used with inline elements while the <div> tag is used with block-level content.

    Example


    <span> tag
    <span>Testing 1</span>
    <span>Testing 2</span>
    <span>Testing 3</span>
    
    Output
    Testing 1 Testing 2 Testing 3
    <div> tag
    <div>Testing 1</div>
    <div>Testing 2</div>
    <div>Testing 3</div>
    
    Output
    Testing 1
    Testing 2
    Testing 3  Output:-This is the First Div
    This is the Second Div 
    HTML:-Div tag HTML:-Div tag Reviewed by Network security on April 29, 2019 Rating: 5

    No comments:

    Useful Information

    Powered by Blogger.