시맨틱 HTML: 그것에 대해 알고 계십니까?
목차
시맨틱 HTML이란 무엇입니까?
If you are learning HTML now, chances are, you are already using semantic HTML. Semantic HTML refers to using meaningful tags for your markup elements which helps the browser, technologies and other developers understand your intentions and what information you are planning to put in that element.
"Can you give some examples of what is a meaningful tag and which is not?" Of course,<div>
and <span>
are examples of HTML elements which has no meaning (non-semantic), it tells us nothing about what information would be rendered. However, header
, nav
, main
are some of the examples of meaningful (semantic) HTML elements. When deciding what elements to use, you should consider "what information do I want to show with this element?" and choose the appropriate semantic element. There are many semantic elements, you can take a look at this cheatsheet 각 시맨틱 태그의 디자인 이면에 있는 의미에 대한 간략한 개요.credit: meme taken from reddit post
처음에는 쉽지 않을 수 있지만 이러한 의미론적 요소를 최대한 활용하는 것이 중요합니다. 이렇게 하면 너무 많은 중첩
<div>
문제를 피하고 웹 페이지에 의미를 부여하는 데 도움이 됩니다. 또한 일부 시맨틱 요소에는 기본적으로 적용된 특정 스타일이 있으므로 해당 스타일이 아닌 해당 의미에 대해 사용해야 합니다. HTML 태그는 구조에 사용되며 표시 및 스타일 지정에는 CSS를 사용해야 합니다.시맨틱 HTML을 사용해야 하는 이유는 무엇입니까?
There are many reasons why you should use semantic HTML, for example, SEO (Search Engine Optimisation). You can influence your website's search ranking by using semantic HTML (amongst other things). Another, equally important reason, is for Accessibility. Remember that, there are people who require assistive technologies like screen readers when accessing the web so using semantic HTML will help the screen reader navigate through your website, find and deliver your content.
It will also make your code more readable and can help make debugging easier.
시맨틱 HTML 사용의 예
Here is a small example of how you can use semantic HTML. I started with a <header>
tag as it is typically for introduction of content or grouping of navigations, inside it, I have a nav
tag which contains <a>
tags, these are link elements that will navigate users away following the link. Next, the <main>
tag signifies this is the primary content of the page and inside I made use of a <figure>
tag to show an image and it's caption. Lastly, the <footer>
tag describe the last bit of information of a section or contains information about copyright, etc.
<header>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/contact">Contact</a>
</nav>
</header>
<main>
<figure>
<img src="https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/c36b1dbf-4dbb-46d1-8ac7-79313cfceb24/darsc3m-4fab6737-6a16-48b0-8710-c16bc4181031.png?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcL2MzNmIxZGJmLTRkYmItNDZkMS04YWM3LTc5MzEzY2ZjZWIyNFwvZGFyc2MzbS00ZmFiNjczNy02YTE2LTQ4YjAtODcxMC1jMTZiYzQxODEwMzEucG5nIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0._kp8Wp6uidemvzyG5yYsV_Tp8VZm-WYvv6DNQfJhuPo" alt="Naturo anime character, fourth hokage">
<figcaption>Fig 1. The Yellow Flash of the Hidden Leaf, the Fourth Hokage.</figcaption>
</figure>
</main>
<footer>copy right</footer>
실제 사례
시맨틱 HTML을 사용하는 웹사이트의 실제 예를 찾았습니다. 즉, 접근성 프로젝트의 웹사이트인 A11Y 입니다. 접근성에 대해 자세히 알아보려면 확실히 확인하세요.
아래 이미지에서 시맨틱 HTML을 사용하여 홈페이지를 구조화했지만 웹사이트 전체에서 시맨틱 HTML을 사용했음을 확인할 수 있습니다. 바닥글의 코드를 보면
nav
요소.요약
In summary, semantic HTML is the practice of using meaningful HTML elements that describe or convey what information is to be displayed. It allows for better SEO to improve the website ranking, increase accessibility of the website, and provides a clearer more readable code for computers and humans. As you move forward with your learning journey, remember to think about semantic HTML when writing your code.
If you want to learn more, here are some additional resources:
읽어주셔서 감사합니다. 도움이 되셨거나 피드백을 제공하고 싶으시면 댓글을 남겨주세요 😃
Reference
이 문제에 관하여(시맨틱 HTML: 그것에 대해 알고 계십니까?), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/justtanwa/semantic-html-do-you-know-about-it-4pi8텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)