Home > Article > Web Front-end > HTML Section vs Div
Div is the Tag that is defined as a division of the Html document. It is mainly used to group of the block elements mainly; it will be used for the CSS Style sheet whenever we use it on the Html page. The section is also a Tag; it describes each and every segment of the Html documents, i.e., in html, the web page has headers, footers, etc. which are called as Sections. Each and every feature will come with this; any one of the bodies of the section comes with the Chapter section.
Below are the top 6 comparisons between HTML Section vs Div:
Let us discuss some key differences between HTML Section vs Div in the following points:
The table below summarizes the comparisons between HTML Section vs Div:
|
Html Div Tag | ||||||||||||||
The tag defines a section of documents like chapters, headers, footers and body sections. | The tag defines a separate division or sections of the documents. | ||||||||||||||
tag is use for html5 version. |
|||||||||||||||
It is not a generic container and global attributes. | It is a generic container. | ||||||||||||||
When creating a section in html 5 version, the id should be a unique one, and the class should use it multiple times when it is needed. | When div tag, place any html elements within the tag and cannot use for inside the tag because the paragraph tag will be broken at any point in time. |
||||||||||||||
Here CSS is not necessary hence it is a structural element used to group together related elements. If. we want to use CSS styles in sections IE 9 browser and some other browsers supported previous IE versions not supported. | Applying CSS styles inside the div tag uses tag, which is used for within inline elements. All browsers will be supported hence no compatibility issue. | ||||||||||||||
Section tag containing article elements in html | Div tag contains all the elements where the tag should not force to do it. |
以下は Section タグと Div タグの例です:
コード:
<html> <body> <section> <h1>Sample</h1> <p>WelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcome</p> </section> <section> <h1>First</h1> <p>WelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomain</p> </section> </body> </html>
出力:
上記の例は、 を使用しています。データを段落形式で表示するにはタグを使用します。 コード: 出力: 上記の例は、背景色などのいくつかの CSS スタイルと のような 1 つの追加タグを含む div タグの例です。ここ タグは上記の コード: 出力: 上記の例は、 The above is the detailed content of HTML Section vs Div. For more information, please follow other related articles on the PHP Chinese website!例 #2 – Div タグ
<html>
<body>
<p>Sample.</p>
<div style="background-color:Green">
<h3>Welcome To My Domain</h3>
<p>Welcome To My Domain</p>
</div>
</body>
</html>
例 #3 – Div タグ
<html>
<head>
<style>
#s{
width:10px;
background: #green;
height:40px;
}
.s1{
width:90px;
font: 60.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size:10px;
font-weight:bold;
}
</style>
</head>
<body>
<marquee><p>Sample.</p></marquee>
<div id="s">
<div class="s1">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">AboutUs</a></li>
<li><a href="#">ContactUs</a></li>
</ul>
</div><!--closing div class for "menu"-->
</div><!--closing div for "container"-->
</body>
</html>