loading
본문 바로가기
HTML,CSS 기초

HTML 태그는 semantics를 사용하자.

by GSTGTS 2022. 1. 6.

HTML 태그는 semantics를 사용하자.

html을 작성하다보면 <div>태그로 도배되는 경우가 있다. <div>를 사용해도 문제는 없지만, 작성자말고 다른 사람들이 코드를 보는 상황을 생각한다면(또는 작성자가 나중에 볼 경우) semantic elements를 이용해서 작성하는 것이 바람직하다. 한번에 이 태그가 지닌 목적과 역할을 알 수 있다.

 

 

https://developer.mozilla.org/en-US/docs/Glossary/Semantics

 

Semantics - MDN Web Docs Glossary: Definitions of Web-related terms | MDN

In programming, Semantics refers to the meaning of a piece of code — for example "what effect does running that line of JavaScript have?", or "what purpose or role does that HTML element have" (rather than "what does it look like?".)

developer.mozilla.org

 

 

헤더부분은 <header>로 푸터부분은 <footer> 태그로 작성한다면, 깔끔하게 보이고 수정할 때 용이하다.

 

여기서 한가지 더.

 

검색엔진에서의 노출순위에도 이점을 가진다. 검색엔진은 semantic elements를 얼마나 잘 썼는지를 검색 순위를 매기는 점수로 사용한다.

반응형

댓글