How to create a section in a document in HTML?

HTMLWeb DevelopmentFront End Technology

Use the <div> tag to add a section in a document. The HTML <div> tag is used for defining a section of your document. With the div tag, you can group large sections of HTML elements together and format them with CSS.

Example

You can try the following code to create a section −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML div Tag</title>
   <link rel = "stylesheet" href = "style2.css">
   </head>
   <body>
      <div id = "contentinfo">
         <p>Welcome to our website. We provide tutorials on various subjects.</p>
      </div>
   </body>
</html>

The following is the css file style2.css

#contentinfo p {
   line-height: 20px;
   margin: 30px;
   padding-bottom: 20px;
   text-align: justify;
   width: 140px;
   color: red;
}
raja
Published on 13-Mar-2018 18:28:28
Advertisements