How to Insert a Div Tag?How to Insert a Div Tag
Hypertext Markup Language employs a number of elements used for creating different sections in a Web page to form a layout; one of them is a div tag (<div>). Div tags are used to section areas of the Web page. Div tags are popular because of their flexibility. They are often used in conjunction with CSS for customization and formatting. Define a div section on a Web page by using the opening <div> and the closing </div> tag
Instructions
1
Open Notepad or your favorite text editing program.
2
Type the following code:
<html>
<body>
<h1>Hello World</h1>
<p>This is a paragraph.</p>
<div style=”color:#00FF00″>
<h1>Hello World</h1>
<p>This is a paragraph.</p>
</div>
</body>
</html>
This code defines a div section on the Web page by using the open <div> closing </div> tags. Content inside the div tags are displayed in green. Information outside of the div tags is displayed in black.
3
Click “File” and then “Save as.” Select “All files” as the “Save as type.”
4
Save your file as an HTML file by placing “.html” at the end of the file name.
5
Go to where you saved your Web page on your hard drive and double-click on it. It should open up in your Web browser. You should see content displayed in green and content displayed in black on the Web page.