

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a section in a document in HTML?
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; }
- Related Questions & Answers
- How do we include a section in an HTML document?
- How do we create a footer for a document or section in HTML5?
- Include a header for a document or section in HTML5?
- How to create a hyperlink to link another document in HTML?
- How to create an HTML Document?
- How do we add a noframe section in HTML?
- How do we add a noscript section in HTML?
- How to create a collapsible section with CSS and JavaScript?
- How to create a responsive contact section for web pages?
- How to create a "section counter" with CSS?
- How to create a Test Strategy Document?
- How to create an FAQ section of a website using JavaScript?
- Create editable content in an HTML document
- How to create a valid HTML document with no <head> element?
- HTML DOM Section Object
Advertisements