1. What is a div tag?
An HTML split tag, or "div" for short, is a special element that allows you to group together similar sets of content on a web page. You can use it as a generic container for associating similar content.
Tags are one of the most commonly used div tags, and despite the introduction of semantic elements that allow you to use multiple tags as containers, it doesn't seem to appear anywhere.
In this tutorial, I'm going to show you the various things you can do with divs with tags, how to use multiple divs in the same html file without getting confused, and how to style it.
2. When to use div tags
The div tag is multipurpose – there are several things you can do with it on your web page. You'll mostly use it in web layouts and CSS art, but it's very flexible.
Eventually, you'll almost always use it to style whatever it contains, or manipulate those things with j**ascript.
1. The div is used in the web layout.
You'll mainly use div tags to group similar things together for easy styling. A good example of this is using divs to group different parts of a web page together. You can put the header, navigation, sections, and footer of a page in a separate div tab so that they can be styled together.
Later in this tutorial, I'll walk you through how to make a web page layout with multiple div tags without getting confused.
The div itself doesn't have a direct impact on the rendering of the content unless you style it.
2. Div is used in CSS art.
With div tags, you can make all kinds of shapes and draw anything because it's easy to style.