<header> <img src="/static/imghw/default1.png" data-src="logo.png" class="lazy" alt="Div를 과도하게 사용하지 마세요! 시맨틱 HTML 모범 사례에 대한 실용 가이드"> <nav> <ul> <li><a href="/">Home</a></li> <li><a href="/about">About</a></li> </ul> </nav> </header> <main> <h2>About Us</h2> <p>Lorem ipsum...</p> <h2>How It Works</h2> <p>Lorem ipsum...</p> <aside>Sidebar content...</aside> </main> <footer> <p>Terms & Conditions</p> </footer>
<header>
: 로고와 기본 탐색 기능이 포함되어 있습니다.<nav>
: 기본 탐색 링크가 있습니다.<main>
: 페이지의 주요 콘텐츠를 포함합니다.<h2>
및 <p>
: 주요 콘텐츠를 논리적으로 구성합니다.<aside>
: 사이드바와 같은 보조 콘텐츠를 나타냅니다.<footer>
: 이용약관 등 덜 중요한 정보를 포함합니다.<main> <h1>JavaScript Guide</h1> <p>Learn JavaScript...</p> <nav> <ul> <li><a href="#toc">Table of Contents</a></li> </ul> </nav> </main>
<main>
요소는 핵심 콘텐츠를 명확하게 정의합니다. 독립형이며 재사용이 가능합니다.<main>
섹션 내에 적절하게 배치됩니다.<div> <p>Why a div here? The info-bar groups unrelated elements (breadcrumbs and a button) purely for layout; they lack a shared semantic purpose.</p> <h2>Summary</h2> <p>Use semantic tags when:</p> <ul> <li>Content is related (<article>).</li> <li>It's self-contained (<article>).</li> <li>It's critical navigation (<nav>).</li> <li>It's secondary content (<aside>).</li> </ul> <p>Use divs when: You need a container solely for styling.</p> <p>If you found this helpful, please like and follow! Thanks for reading!</p> <p>Connect with me on:</p> <p><strong>LinkedIn</strong> | <strong>Medium</strong> | <strong>Bluesky</strong></p> </div>
위 내용은 Div를 과도하게 사용하지 마세요! 시맨틱 HTML 모범 사례에 대한 실용 가이드의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!