>  기사  >  웹 프론트엔드  >  HTML 섹션과 Div

HTML 섹션과 Div

王林
王林원래의
2024-09-04 16:17:02658검색

Div는 HTML 문서의 분할로 정의된 태그입니다. 주로 블록 요소를 그룹화하는 데 사용됩니다. Html 페이지에서 사용할 때마다 CSS 스타일 시트에 사용됩니다. 섹션은 태그이기도 합니다. 이는 Html 문서의 모든 세그먼트를 설명합니다. 즉, html에서 웹 페이지에는 섹션이라고 불리는 머리글, 바닥글 등이 있습니다. 각각의 모든 기능이 이와 함께 제공됩니다. 섹션의 본문 중 하나가 챕터 섹션과 함께 제공됩니다.

HTML 섹션과 Div(인포그래픽)의 정면 비교

아래는 HTML 섹션과 Div의 상위 6가지 비교입니다:

HTML 섹션과 Div

HTML 섹션과 Div의 주요 차이점

다음 사항에서 HTML 섹션과 Div의 주요 차이점을 살펴보겠습니다.

  • 모든 개념 세트에는 어느 정도 장점과 차이점이 있습니다.
  • 이 섹션은 일부 일반 또는 HTML 문서를 나타냅니다. div는 일반적인 흐름 컨테이너이기도 합니다. 사용자 요구 사항에 따라 스타일 목적이 필요할 때마다 섹션 요소가 필요하거나 때로는 스크립트(프론트 엔드 코드)가 그 시간을 변경해야 하는 경우 div 태그 대신 섹션 태그가 사용됩니다.
  • 섹션 태그는 데이터베이스에 개별 바이너리 레코드를 저장하는 데 사용되는 콘텐츠 덩어리에 사용됩니다. div 태그는 일반적으로 블록 수준 유형에 사용되므로 Blob 유형과 같은 추가 기능이 없는 요소입니다.
  • div 태그는 일반적으로 구분 유형이나 섹션 유형을 정의하는 빈 컨테이너입니다. 개발자가 프런트 엔드 코드를 작성하거나 머리글, 바닥글 또는 레이아웃 변경과 같은 형식을 작성하는 내용(가로 및 세로 레이아웃 모두)에는 영향을 주지 않으며 영향을 주지 않습니다. 그러나 섹션에서는 각 섹션 유형을 식별하고

    요소.
  • 대신 요소의 내용을 배포하기 위해 별도로 만드는 섹션 요소입니다. 태그 요소.
  • html5 섹션에는 유동 콘텐츠, 섹션 콘텐츠, 뚜렷한 콘텐츠와 같은 카테고리가 있습니다. 또한 이전 버전과 동일합니다. 규칙은 일반적인 <섹션> 태그 요소는 다른 요소의 내용이 명시적인 방식으로 나열되는 경우에만 적합합니다. Div는
    htm5의 태그는 분할 태그에 사용되는 이전 버전 기능과 동일합니다.
    중첩된 div 태그에도 사용되며, 상위 태그와 하위 태그 관계는
    및 <섹션> 태그

HTML 섹션과 Div 비교표

아래 표에는 HTML 섹션과 Div의 비교가 요약되어 있습니다:

Html Section Tag 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.
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.

Html 섹션 태그 Html Div 태그 태그는 장, 머리글, 바닥글, 본문 섹션과 같은 문서 섹션을 정의합니다. 태그는 문서의 별도 부문이나 섹션을 정의합니다. <섹션> 태그는 html5 버전에 사용됩니다.
태그는 html5 버전에 사용됩니다. 일반 컨테이너 및 전역 속성이 아닙니다. 일반 컨테이너입니다. html 5 버전에서 섹션을 생성할 때 id는 고유한 것이어야 하며 클래스는 필요할 때 이를 여러 번 사용해야 합니다. div 태그를 사용할 때
태그이므로

내부에는 사용할 수 없습니다. 태그는 단락 태그가 언제든지 깨질 수 있기 때문입니다. 여기서 CSS는 필요하지 않으므로 관련 요소를 그룹화하는 데 사용되는 구조 요소입니다. 만약에. 섹션에서 CSS 스타일을 사용하고 싶습니다. IE 9 브라우저 및 일부 다른 브라우저는 지원되지 않는 이전 IE 버전을 지원했습니다. div 태그 내부에 CSS 스타일을 적용하면 인라인 요소 내에서 사용되는 태그입니다. 모든 브라우저가 지원되므로 호환성 문제가 없습니다. html의 기사 요소를 포함하는 섹션 태그 Div 태그에는

태그를 강제로 수행해서는 안 됩니다.

Contoh untuk Tag Bahagian & Tag Div

Di bawah ialah contoh Tag Bahagian dan Tag Div:

Contoh #1 – Tag Bahagian

Kod:

<html>
<body>
<section>
<h1>Sample</h1>
<p>WelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcomeWelcome</p>
</section>
<section>
<h1>First</h1>
<p>WelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomainWelcometomydomain</p>
</section>
</body>
</html>

Output:

HTML 섹션과 Div

Contoh di atas adalah asas untuk teg digunakan untuk dua kali dalam dokumen html satu bahagian adalah sampel dan satu lagi kedua-duanya menggunakan

tag untuk memaparkan data dalam format perenggan.

Contoh #2 – Tag Div

Kod:

<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>

Output:

HTML 섹션과 Div

Contoh di atas adalah untuk teg div dengan beberapa gaya CSS seperti warna latar belakang dan dengan satu teg tambahan seperti

,di sini

teg digunakan untuk

teg maka ia adalah teg perenggan jadi ia tidak akan digunakan untuk
tag di dalam.

Contoh #3 – Teg Div

Kod:

<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>

Output:

HTML 섹션과 Div

Contoh di atas sama seperti

tag, tetapi di sini kami menggunakan tag div bersarang ia adalah lebih kelebihan jika dibandingkan dengan tag bahagian; selain itu, kami menggunakan yang sama dalam contoh di atas dalam gaya CSS di sini satu teg div kami menggunakan gaya CSS sebagai id dan satu lagi teg div kami menggunakan gaya CSS sebagai kelas supaya ia akan memisahkan daripada satu teg div ke dalam teg div yang lain. Oleh itu, apa sahaja dan bila-bila masa kita menggunakan
teg, ia akan ditutup dengan sewajarnya
tag adalah satu kemestian; jika tidak, kod tidak akan dilaksanakan dengan betul. Kami menggunakan tag tambahan untuk beberapa menghidupkannya untuk tarikan pengguna.

Kesimpulan

Di atas topik, kami membincangkan perbezaan antara teg bahagian dan div; beberapa lagi langkah dan mata adalah sama dengan kedua-dua konsep. Tetapi beberapa kali dan beberapa ciri boleh diterima untuk teg bahagian, dan sesetengahnya menerima untuk teg div. Walau bagaimanapun, objektif dan operasi adalah baris yang sama dalam dokumen html.

위 내용은 HTML 섹션과 Div의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.