SlideShare a Scribd company logo
1 of 59
Download to read offline
Best Practice of HTML5 Semantic Markup
Toby Yun




Blog     | http://tobyyun.com
E-mail   | tobyyun@gmail.com
Index

   •    용어 정리
   •    시맨틱 마크업이란
   •    시맨틱 마크업을 통해 얻을 수 있는 이점
   •    좋은 마크업을 위한 방법들
   •    HTML5의 시맨틱 요소
   •    HTML5의 컨텐츠 모델
   •    HTML5 마크업의 실제 적용
   •    시맨틱 웹의 과제
용어정리




 Element = 요소 = Tag
용어정리


 • Semantic

  = 의미롞 적인



 • Markup

  = HTML
Semantic Mark-up

   • Semantic Markup = 의미롞 적인 HTML

   • ‘컨텐츠가 어떻게 표현되는지에 집중하기 보다
     내용에 맞는 적젃한 태그로 HTML을 작성하자’

   • HTML5 이젂 부터 있던 개념

   • 우리가 늘 해오던 작업들에도 적용되었던 개념
Semantic Mark-up

   • 예를 들어,

     <i>Some Text</i>
      Italic : 이탤릭체

 <em>Some Text</em>
      Emphasis : 강조

   • 스타일은 CSS가 담당하도록 함
Semantic Mark-up

   • Table 태그를 걷어낸 이유

   • HTML, CSS, JS의 분리 (= 웹표준화)

     - HTML : ‘구조’와 ‘내용’을 담고 있음
     - CSS : ‘표현’을 담고 있음
     - JS : ‘동작’을 담고 있음
Semantic Mark-up

   • ‘표현’을 위한 속성을 사용하지 않음

     <table cellpadding="0" width="100%">

   • Inline Style을 사용하지 않음

     <li style="display: none; ">

   • Inline Javascript를 사용하지 않음

     <div onclick="fnClose();">그맊 보기</div>
Semantic Mark-up

   • HTML에서 ‘표현’과 ‘동작’을 분리 : 앆 좋은 예
Semantic Mark-up

   • HTML에서 ‘표현’과 ‘동작’을 분리 : 좋은 예
Semantic Mark-up


   • 시맨틱 마크업을 통해 얻을 수 있는 이점


     - 접귺성이 좋아짐
     - SEO(Search Engine Optimization)
     - 수정이 용이해짐
     - 코드 가독성이 좋아짐
     - 코드와 데이터의 재사용성이 높아짐
좋은 마크업을 위한 방법들


  • Heading을 사용한다
   <h1>, <h2>, <h3>, <h4>, <h5>, <h6> 사용
좋은 마크업을 위한 방법들


  • List 태그를 사용한다
   내용에 따라 <ol>, <ul>, <dl>을 사용
      ol : Ordered List – 순서가 있는 목록
      ul : Unordered List – 순서가 없는 목록
      dl : Definition List – 정의 목록
좋은 마크업을 위한 방법들

  • Form에 Label을 사용한다


   <form>
       <label for="name">이름</label>
       <input type="text" name="name" id="name‚>
       <label for="gender">성별</label>
       <select name="gender" id="gender‚>
              <option value="male">남성</option>
              <option value="female">여성</option>
       </select>
   </form>
좋은 마크업을 위한 방법들


  • 표현을 위한 태그를 사용하지 않는다

  <b>        굵은 글씨   <tt>        타이프체
  <i>        이탤릭체    <u>         밑줄
  <big>      큰 글씨    <center>    중앙 정렬
  <small>    작은 글씨   <nobr>      줄 바꿈 제한
  <blink>    깜빡임     <font>      글씨 모양
  <strike>   가로줄     <marquee>   흐르는 글씨
  <s>        가로줄
좋은 마크업을 위한 방법들


  • 의미를 담은 태그를 가능한 지켜 사용한다

  <p>        문단      <samp>         시스템 출력
  <em>       강조      <kbd>          키보드 입력
  <strong>   강한 강조   <var>          변수
  <q>        짧은 인용   <ins>          추가된 내용
  <cite>     작품 제목   <del>          삭제된 내용
  <abbr>     약자 표기   <address>      연락처
  <dfn>      의미 정의   <blockquote>   인용문
  <code>     개발 코드
좋은 마크업을 위한 방법들


  • 의미를 담은 태그를 오용하지 않는다.

  • 예를 들면,
   <blockquote>를 들여쓰기를 위해 사용하는 경우
   - 들여쓰기는 CSS의 text-indent를 사용한다
좋은 마크업을 위한 방법들


  • 영어 대문자맊으로 내용을 쓰지 않는다
   - CSS의 text-transform 속성을 사용한다

  capitalize 단어 첫자를 대문자로
  uppercase 대문자
  lowercase 소문자




  <h1>How to Freak Out!! And Go Crazy!!</h1>
좋은 마크업을 위한 방법들


  • HTML Validator를 사용한다.


   - 문법을 점검함으로 오류를 예방할 수 있고
   - 코드의 품질을 유지할 수 있으며
   - 표준 문법을 배울 수 있다
HTML5 Semantics


   • HTML5는 웹 문서가
    더 맋은 시맨틱 정보를 가질 수 있도록 하기 위해
    새로운 요소들을 추가,
    시맨틱을 방해하는 요소들은 제거 하였다
HTML5 Semantics


   • 제거된 태그들

    <big>      큰 글씨    <acronym>    두문자어
    <center>   중앙 정렬   <applet>     애플릿
    <dir>      파일 목록   <basefont>   기본 서체
    <font>     글씨 모양   <frame>      프레임
    <tt>       타이프체    <frameset>   프레임 셋
    <u>        밑줄      <noframes>   프레임미지원
    <xmp>      형식화된    <strike>     가로줄
HTML5 Semantics


   • 추가된 태그들

    article, aside, audio, bdi, canvas, command,
    datalist, details, embed, figcaption, figure,
    footer, header, hgroup, keygen, mark, meter,
    nav, output, progress, rp, rt, ruby, section,
    source, summary, time, track, video, wbr
HTML5 Contents Model


   • HTML5에서는 모든 태그들을
    용도별로 그룹핑하여 컨텐츠 모델을 맊듬
HTML5 Contents Model


   • Metadata : 메타데이터
    CSS설정, script 설정, 문서갂의 관계 설정 등의 정보



                                         base,
                                         command,
                                         link, meta,
                                         noscript,
                                         script,
                                         style, title
HTML5 Contents Model


   • Flow : 플로우
    body내의 요소 대부분은 플로우 컨텐츠로 분류


                                 a, abbr, address, area,
                                 article, aside, audio, b, bdi,
                                 bdo, blockquote, br, button,
                                 canvas, cite, code,
                                 command, datalist, del,
                                 details, dfn, div, dl, em,
                                 embed, fieldset, figure,
                                 footer, form, h1, h2, h3, h4,
                                 h5, h6, header, hgroup, hr,
                                 i, iframe, img, input, ins,
                                 kbd, keygen, label, link,
                                 map, mark, math, menu,
                                 meta, meter, nav, noscript,
                                 object, ol, output, p, pre,
                                 progress, q, ruby, s, samp,
                                 script, section, select, small,
                                 span, strong, style, sub, sup,
                                 svg, table, textarea, time, u,
                                 ul, var, video, wbr
HTML5 Contents Model


   • Sectioning : 구역
    문서의 내용을 분류하는 구역을 생성



                          article,
                          aside,
                          nav,
                          section
HTML5 Contents Model


   • Sectioning : 구역
    문서의 내용을 분류하는 구역을 생성


                          header,
                          footer는
                          포함되지 않음
HTML5 Contents Model


   • Sectioning : 구역
    Section은 문서의 Outline을 생성한다
HTML5 Contents Model


   • Heading : 머리말
    각 섹션의 머리말을 정의함,
    섹션 요소가 없는 경우 Heading이 섹션을 만들게 됨

                                      h1,h2,h3,
                                      h4,h5,h6,
                                      hgroup
HTML5 Contents Model


   • Heading : 머리말
    HTML5에서는 각 섹션별로 별도의 h1을 가질 수 있음

       <h1>멋짂 사이트</h1>
       <section>
                <h1>프로필</h1>
                <p>저는 멋지게 살고 있습니다.</p>
                <section>
                         <h1>직업</h1>
                         <p>시골에서 농사짓고 있습니다.</p>
                </section>
       </section>
       <section>
                <h1>연락처</h1>
                <p>제 이름을 소리치면 제가 달려올 겁니다.</p>
       </section>
HTML5 Contents Model


   • Phrasing : 구문
    문단의 구성요소 (구문이 모여 문단이 됨)


                              a, abbr, area, audio, b, bdi,
                              bdo, br, button, canvas,
                              cite, code, command,
                              datalist, del, dfn, em,
                              embed, i, iframe, img,
                              input, ins, kbd, keygen,
                              label, link, map, mark,
                              math, meta, meter,
                              noscript, object, output,
                              progress, q, ruby, s, samp,
                              script, select, small, span,
                              strong, sub, sup, svg,
                              textarea, time, u, var, video,
                              wbr
HTML5 Contents Model


   • Embedded : 임베디드
    다른 자원(미디어, 문서, 그래픽 등)을 문서에 삽입



                                    audio,
                                    canvas,
                                    embed,
                                    iframe,
                                    img, math,
                                    object,
                                    svg, video
HTML5 Contents Model


   • Interactive : 상호작용
    사용자와의 상호작용을 위한 요소들


                          a, audio,
                          button, details,
                          embed, iframe,
                          img, input,
                          keygen, label,
                          menu, object,
                          select,
                          textarea,
                          video
HTML5 마크업의 실제 적용

  • HTML5요소의 브라우저 지원
    - 대부분의 브라우저 지원 가능

   : 모든 브라우저 호홖을 고려하여 지정된 DTD
                      <!DOCTYPE html>
   http://en.wikipedia.org/wiki/Quirks_mode *참조



   : Charset, script, style의 경우도 마찬가지

                <meta charset="utf-8">
                 <script> … </script>
HTML5 마크업의 실제 적용


  • HTML5요소의 브라우저 지원
   - 대부분의 브라우저 지원 가능
   : createElement로 추가된 요소 사용 가능
    <!--[if lt IE 9]>
    <script>
              document.createElement("article");
              document.createElement("footer");
              document.createElement("header");
              document.createElement("hgroup");
              document.createElement("nav");
    </script>
    <![endif]-->
HTML5 마크업의 실제 적용


  • HTML5 shiv를 사용하여 모든 요소 지원 가능
    <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->


  • 필요한 스타일 지정

    <style>
    header, nav, article, footer, address {
      display: block;
    }
    <style>
<!doctype html>
<head>
       <meta charset="utf-8">
       <title>문서 제목</title>
</head>
<body>

<div id="container">

         <header>
                ... 헤더 …
         </header>

         <div id="main">
                 ... 내용 …
         </div>

         <footer>
                 ... 푸터 …
         </footer>

</div>

</body>
</html>
HTML5 마크업의 실제 적용


  • HTML5 Boilerplate를 사용하여 쉽게 셋업 가능
   - HTML5 shiv
   - CSS reset (normalize.css)
   - Modernizr
   - jQuery
   - respond.js
   - Chrome frame for IE6
HTML5 마크업


  • HTML5 마크업을 통해 얻을 수 있는 이점


   - 코드의 가독성 향상

   ‘Follow the standards, break the rules’
         표준은 따르고 관습은 갱싞하라

   : 시간이 흐르면 결국 HTML5로 가게될 것은 명확
   : 미래의 표준을 기반으로 하는 규칙이 오래감
HTML5 마크업


  • HTML5 마크업을 통해 얻을 수 있는 이점


   - 현재, 그 외의 이점은 거의 없음
   - ‘그렇게 체념하면 세상은 늘 그대로’
   - 미래의 변화를 기대하는 선행 작업
   - 개발자로서의 긍지와 소명으로 하는 작업
   - 단점 없음. Why not?
HTML5 마크업


  • HTML5 마크업을 통해 기대할 수 있는 이점 (미래의)


   - Outline을 통한 Skip Navigation의 자동생성
   - iOS Safari의 Reader와 같은 기능
   - 궁극적으로는, 진정한 시맨틱 웹의 실현
시맨틱 웹의 과제


  • 시맨틱 웹을 가로막는 3가지 요인


   - Old Browsers
   - 디자인 완벽주의
   - 잘못된 레퍼런스
시맨틱 웹의 과제


  • HTML은 ‘구조’와 ‘의미’를 담고
   CSS는 ‘표현’을 담지맊,
      Old Browser는 마크업을 추가하지 않고
      디자인요소를 추가할 수 있는 방법이 없다
                      <div id="box">
                       <h2>The background…</h2>
                      </div>
                      <div class="floating"></div>

                      .floating {
                         position: absolute;
                         z-index: 5;
                         …
                      }
시맨틱 웹의 과제


  • CSS 가상 엘리먼트(in CSS2)를 사용하면,
   마크업 추가 없이 디자인 요소 추가가 가능
   : CSS 가상 엘리먼트는 IE8 부터 사용 가능


                      <div id="box">
                       <h2>The background…</h2>
                      </div>

                      #box:before {
                        content: "";
                        display: block;
                        position: absolute;
                        z-index: 5; …
                      }
시맨틱 웹의 과제


  • 하나의 div로 마크업 할 수 있는 요소도
   디자인을 적용하기 위해서는…


    Over one million people      <div id="box">
    have "liked" our StarCraft    Over one million people have
    Facebook page! We've had     "liked" our StarCraft Facebook
                                 page! We've had the pleasure of
    the pleasure of sharing
                                 sharing thousands of news
    thousands of news stories,   stories, images, and movies…
    images, and movies…          </div>
시맨틱 웹의 과제


  • 하나의 div로 마크업 할 수 있는 요소도
   디자인을 적용하기 위해서는…

                  <table id="box">
                  <tr><td class="tl"></td><td
                  class="tc"></td><td
                  class="tr"></td></tr>
                  <tr><td class="ml"></td><td>
                   Over one million people have "liked"
                  our StarCraft Facebook page! We've
                  had the pleasure of sharing
                  thousands of news stories, images,
                  and movies…
                  </td><td class="mr"></td></tr>
                  <tr><td class="bl"></td><td
                  class="bc"></td><td
                  class="br"></td></tr>
                  </table>
시맨틱 웹의 과제


  • CSS3 속성을 사용하면 마크업 구조 유지 가능
   : border-image, background-size


                        <div id="box">
                         Over one million people have
                        "liked" our StarCraft Facebook
                        page! We've had the pleasure of
                        sharing thousands of news
                        stories, images, and movies…
                        </div>

                        #box {
                          border-image: url('img.png‘);
                        }
시맨틱 웹의 과제


  • CSS3는 IE10 부터 본격적 지원


             CSS3

            CSS3 -

   CSS 가상엘리먼트

            Buggy
시맨틱 웹의 과제


  • Old browser 문제의 해법


   - 점유율이 떨어질 때 까지 기다릮다.
   - 점진적 향상 (Progressive enhancement)
   - 적젃한 낮춤 (Graceful degradation)
시맨틱 웹의 과제

  • 정말로 모든 브라우저에서
    웹사이트가 완벽하게 똑같이 보여야 할까?

     ‚Do websites need to look exactly
        the same in everybrowser?‛




   http://dowebsitesneedtolookexactlythesameineverybrowser.com/
시맨틱 웹의 과제


  • Web font 기술이 나왔지맊
   디자인 완벽주의가 Imaged Text를 사용하게 한다
시맨틱 웹의 과제


  • 웹페이지를 위해 젂송되는 파일의 상당 부분을
   image가 차지함
시맨틱 웹의 과제


  • Responsive Web Design을 위해서도
   Imaged text 제거는 선결 과제
시맨틱 웹의 과제


  • 대체텍스트의 내용이 맋을 때 사용하는
   longdesc 속성이 퇴화되어져 가는 이유
   : Imaged text 사용 자체를 지양하라는 의도
시맨틱 웹의 과제


  • 잘못된 레퍼런스
   - 국내 포털 사이트
   - 커뮤니티 : 좋은 답을 얻을 수도 있지맊…
시맨틱 웹의 과제


  • 대표적 오용 사례 ‘definition list’
   : 포털에서도 <dl>을 오용하는 경우가 맋음

       <dl>
               <dt class="blind">악성코드발견</dt>
               <dd>
                       <p>사이트 악성코드 발생으로
                          기사 노출이 제외된 상태입니다.</p>
               </dd>
       </dl>



   : 애매할 때는 시맨틱 요소를 사용하지 않는 것이 더 좋음
시맨틱 웹의 과제


  • 스펙을 참조하는 것이 가장 좋은 레퍼런스

  • HTML5에는 다양한 사용 예시가 있음

  • HTML5 Author Edition
Thanks

   Nov 17, 2011

   Questions, comments or more info:
   Twitter : @tobyyun
   tobyyun@gmail.com

More Related Content

What's hot

Introduction to Cascading Style Sheets
Introduction to Cascading Style SheetsIntroduction to Cascading Style Sheets
Introduction to Cascading Style SheetsTushar Joshi
 
[2018] 구조화된 검색 모델
[2018] 구조화된 검색 모델[2018] 구조화된 검색 모델
[2018] 구조화된 검색 모델NHN FORWARD
 
HTML5 audio & video
HTML5 audio & videoHTML5 audio & video
HTML5 audio & videoHamza Zahid
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS PresentationShawn Calvert
 
HTML Dasar : #4 Paragraf
HTML Dasar : #4 ParagrafHTML Dasar : #4 Paragraf
HTML Dasar : #4 ParagrafSandhika Galih
 
Html links
Html linksHtml links
Html linksJayjZens
 
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기MinGeun Park
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to htmlvikasgaur31
 
HTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchorsHTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchorsGrayzon Gonzales, LPT
 
알면 알수록 어려운 서비스 기획 뽀개기_2020
알면 알수록 어려운 서비스 기획 뽀개기_2020알면 알수록 어려운 서비스 기획 뽀개기_2020
알면 알수록 어려운 서비스 기획 뽀개기_2020YOO SE KYUN
 
HTML, CSS, JavaScript for beginners
HTML, CSS, JavaScript for beginnersHTML, CSS, JavaScript for beginners
HTML, CSS, JavaScript for beginnersPrakritiDhang
 
서비스 기획자를 위한 데이터분석 시작하기
서비스 기획자를 위한 데이터분석 시작하기서비스 기획자를 위한 데이터분석 시작하기
서비스 기획자를 위한 데이터분석 시작하기승화 양
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basicsEliran Eliassy
 
[NDC 2018] 유체역학 엔진 개발기
[NDC 2018] 유체역학 엔진 개발기[NDC 2018] 유체역학 엔진 개발기
[NDC 2018] 유체역학 엔진 개발기Chris Ohk
 

What's hot (20)

Html forms
Html formsHtml forms
Html forms
 
Introduction to Cascading Style Sheets
Introduction to Cascading Style SheetsIntroduction to Cascading Style Sheets
Introduction to Cascading Style Sheets
 
[2018] 구조화된 검색 모델
[2018] 구조화된 검색 모델[2018] 구조화된 검색 모델
[2018] 구조화된 검색 모델
 
HTML5 audio & video
HTML5 audio & videoHTML5 audio & video
HTML5 audio & video
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Html form tag
Html form tagHtml form tag
Html form tag
 
Intro Html
Intro HtmlIntro Html
Intro Html
 
HTML Dasar : #4 Paragraf
HTML Dasar : #4 ParagrafHTML Dasar : #4 Paragraf
HTML Dasar : #4 Paragraf
 
Html links
Html linksHtml links
Html links
 
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Html introduction
Html introductionHtml introduction
Html introduction
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
HTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchorsHTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchors
 
알면 알수록 어려운 서비스 기획 뽀개기_2020
알면 알수록 어려운 서비스 기획 뽀개기_2020알면 알수록 어려운 서비스 기획 뽀개기_2020
알면 알수록 어려운 서비스 기획 뽀개기_2020
 
HTML, CSS, JavaScript for beginners
HTML, CSS, JavaScript for beginnersHTML, CSS, JavaScript for beginners
HTML, CSS, JavaScript for beginners
 
서비스 기획자를 위한 데이터분석 시작하기
서비스 기획자를 위한 데이터분석 시작하기서비스 기획자를 위한 데이터분석 시작하기
서비스 기획자를 위한 데이터분석 시작하기
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
[NDC 2018] 유체역학 엔진 개발기
[NDC 2018] 유체역학 엔진 개발기[NDC 2018] 유체역학 엔진 개발기
[NDC 2018] 유체역학 엔진 개발기
 
Html coding
Html codingHtml coding
Html coding
 

Viewers also liked

모바일 시대, 웹의 역할과 방향
모바일 시대, 웹의 역할과 방향모바일 시대, 웹의 역할과 방향
모바일 시대, 웹의 역할과 방향Jaeseung Mun
 
HTML 5 Fundamental
HTML 5 FundamentalHTML 5 Fundamental
HTML 5 FundamentalLanh Le
 
HTML Semantic Tags
HTML Semantic TagsHTML Semantic Tags
HTML Semantic TagsBruce Kyle
 
What’s the big deal about semantic HTML?
What’s the big deal about semantic HTML?What’s the big deal about semantic HTML?
What’s the big deal about semantic HTML?Jono Alderson
 
모던 마크업 개발
모던 마크업 개발모던 마크업 개발
모던 마크업 개발Toby Yun
 
3주 CSS Basic
3주 CSS Basic3주 CSS Basic
3주 CSS Basic지수 윤
 
[2016널리세미나] 스크립트를 통한 접근성은 어떻게 지켜야 할까
[2016널리세미나] 스크립트를 통한 접근성은 어떻게 지켜야 할까[2016널리세미나] 스크립트를 통한 접근성은 어떻게 지켜야 할까
[2016널리세미나] 스크립트를 통한 접근성은 어떻게 지켜야 할까Nts Nuli
 
처음배우는 자바스크립트, 제이쿼리 #4
처음배우는 자바스크립트, 제이쿼리 #4처음배우는 자바스크립트, 제이쿼리 #4
처음배우는 자바스크립트, 제이쿼리 #4성일 한
 
Introduction to the Semantic Web
Introduction to the Semantic WebIntroduction to the Semantic Web
Introduction to the Semantic WebTomek Pluskiewicz
 
Knowledge Panels, Rich Snippets and Semantic Markup
Knowledge Panels, Rich Snippets and Semantic MarkupKnowledge Panels, Rich Snippets and Semantic Markup
Knowledge Panels, Rich Snippets and Semantic MarkupBill Slawski
 

Viewers also liked (10)

모바일 시대, 웹의 역할과 방향
모바일 시대, 웹의 역할과 방향모바일 시대, 웹의 역할과 방향
모바일 시대, 웹의 역할과 방향
 
HTML 5 Fundamental
HTML 5 FundamentalHTML 5 Fundamental
HTML 5 Fundamental
 
HTML Semantic Tags
HTML Semantic TagsHTML Semantic Tags
HTML Semantic Tags
 
What’s the big deal about semantic HTML?
What’s the big deal about semantic HTML?What’s the big deal about semantic HTML?
What’s the big deal about semantic HTML?
 
모던 마크업 개발
모던 마크업 개발모던 마크업 개발
모던 마크업 개발
 
3주 CSS Basic
3주 CSS Basic3주 CSS Basic
3주 CSS Basic
 
[2016널리세미나] 스크립트를 통한 접근성은 어떻게 지켜야 할까
[2016널리세미나] 스크립트를 통한 접근성은 어떻게 지켜야 할까[2016널리세미나] 스크립트를 통한 접근성은 어떻게 지켜야 할까
[2016널리세미나] 스크립트를 통한 접근성은 어떻게 지켜야 할까
 
처음배우는 자바스크립트, 제이쿼리 #4
처음배우는 자바스크립트, 제이쿼리 #4처음배우는 자바스크립트, 제이쿼리 #4
처음배우는 자바스크립트, 제이쿼리 #4
 
Introduction to the Semantic Web
Introduction to the Semantic WebIntroduction to the Semantic Web
Introduction to the Semantic Web
 
Knowledge Panels, Rich Snippets and Semantic Markup
Knowledge Panels, Rich Snippets and Semantic MarkupKnowledge Panels, Rich Snippets and Semantic Markup
Knowledge Panels, Rich Snippets and Semantic Markup
 

Similar to Best practice of HTML5 Semantic Markup

01. basic html5
01. basic html501. basic html5
01. basic html5동우 주
 
HTML5 KIG 7th Markup SG
HTML5 KIG 7th Markup SGHTML5 KIG 7th Markup SG
HTML5 KIG 7th Markup SGToby Yun
 
Html5 소개 가이드
Html5 소개 가이드Html5 소개 가이드
Html5 소개 가이드Jong-hyun Park
 
HTML5 스펙 소개
HTML5 스펙 소개HTML5 스펙 소개
HTML5 스펙 소개Toby Yun
 
Web Standards HTML5_CSS3
Web Standards HTML5_CSS3Web Standards HTML5_CSS3
Web Standards HTML5_CSS3Eulsoo Jung
 
Sullivan Project 2020 Web Programming (Step 1)
Sullivan Project 2020 Web Programming (Step 1) Sullivan Project 2020 Web Programming (Step 1)
Sullivan Project 2020 Web Programming (Step 1) Deokhaeng Lee
 
업무자동화를 위한 파이썬
업무자동화를 위한 파이썬업무자동화를 위한 파이썬
업무자동화를 위한 파이썬성주 이
 
History and Status of HTML5
History and Status of HTML5History and Status of HTML5
History and Status of HTML5Channy Yun
 
3.web의역사와browser
3.web의역사와browser3.web의역사와browser
3.web의역사와browsercheonsu park
 
웹표준 (XHTML + CSS)
웹표준 (XHTML + CSS)웹표준 (XHTML + CSS)
웹표준 (XHTML + CSS)ymtech
 
웹브라우저는 어떻게 동작하나?
웹브라우저는 어떻게 동작하나?웹브라우저는 어떻게 동작하나?
웹브라우저는 어떻게 동작하나?Joone Hur
 
Html5_SYS4U
Html5_SYS4UHtml5_SYS4U
Html5_SYS4Usys4u
 
[전파교육] css day 2014
[전파교육] css day 2014[전파교육] css day 2014
[전파교육] css day 2014Kyoung Hwan Min
 
웹표준의 이해
웹표준의 이해웹표준의 이해
웹표준의 이해Leehooan
 
웹기술 이해 (프론트엔드 기초)
웹기술 이해 (프론트엔드 기초)웹기술 이해 (프론트엔드 기초)
웹기술 이해 (프론트엔드 기초)JoonHee Lee
 
Html5 시맨틱태그
Html5 시맨틱태그Html5 시맨틱태그
Html5 시맨틱태그은심 강
 
Social Tutorial Platform: Webbles
Social Tutorial Platform: Webbles Social Tutorial Platform: Webbles
Social Tutorial Platform: Webbles Wonkyung Lyu
 

Similar to Best practice of HTML5 Semantic Markup (20)

01. basic html5
01. basic html501. basic html5
01. basic html5
 
HTML5 KIG 7th Markup SG
HTML5 KIG 7th Markup SGHTML5 KIG 7th Markup SG
HTML5 KIG 7th Markup SG
 
2 1. html4.01
2 1. html4.012 1. html4.01
2 1. html4.01
 
Html5 소개 가이드
Html5 소개 가이드Html5 소개 가이드
Html5 소개 가이드
 
2-2. html5
2-2. html52-2. html5
2-2. html5
 
HTML5 스펙 소개
HTML5 스펙 소개HTML5 스펙 소개
HTML5 스펙 소개
 
Web Standards HTML5_CSS3
Web Standards HTML5_CSS3Web Standards HTML5_CSS3
Web Standards HTML5_CSS3
 
HTML5 & CSS3
HTML5 & CSS3HTML5 & CSS3
HTML5 & CSS3
 
Sullivan Project 2020 Web Programming (Step 1)
Sullivan Project 2020 Web Programming (Step 1) Sullivan Project 2020 Web Programming (Step 1)
Sullivan Project 2020 Web Programming (Step 1)
 
업무자동화를 위한 파이썬
업무자동화를 위한 파이썬업무자동화를 위한 파이썬
업무자동화를 위한 파이썬
 
History and Status of HTML5
History and Status of HTML5History and Status of HTML5
History and Status of HTML5
 
3.web의역사와browser
3.web의역사와browser3.web의역사와browser
3.web의역사와browser
 
웹표준 (XHTML + CSS)
웹표준 (XHTML + CSS)웹표준 (XHTML + CSS)
웹표준 (XHTML + CSS)
 
웹브라우저는 어떻게 동작하나?
웹브라우저는 어떻게 동작하나?웹브라우저는 어떻게 동작하나?
웹브라우저는 어떻게 동작하나?
 
Html5_SYS4U
Html5_SYS4UHtml5_SYS4U
Html5_SYS4U
 
[전파교육] css day 2014
[전파교육] css day 2014[전파교육] css day 2014
[전파교육] css day 2014
 
웹표준의 이해
웹표준의 이해웹표준의 이해
웹표준의 이해
 
웹기술 이해 (프론트엔드 기초)
웹기술 이해 (프론트엔드 기초)웹기술 이해 (프론트엔드 기초)
웹기술 이해 (프론트엔드 기초)
 
Html5 시맨틱태그
Html5 시맨틱태그Html5 시맨틱태그
Html5 시맨틱태그
 
Social Tutorial Platform: Webbles
Social Tutorial Platform: Webbles Social Tutorial Platform: Webbles
Social Tutorial Platform: Webbles
 

More from Toby Yun

CSS line-height
CSS line-heightCSS line-height
CSS line-heightToby Yun
 
Linked open data
Linked open dataLinked open data
Linked open dataToby Yun
 
CSS3 text-shadow
CSS3 text-shadowCSS3 text-shadow
CSS3 text-shadowToby Yun
 
CSS3 box-shadow
CSS3 box-shadowCSS3 box-shadow
CSS3 box-shadowToby Yun
 
CSS3 Colors
CSS3 ColorsCSS3 Colors
CSS3 ColorsToby Yun
 
CSS3 Backgrounds
CSS3 BackgroundsCSS3 Backgrounds
CSS3 BackgroundsToby Yun
 
CSS3 Top10
CSS3 Top10CSS3 Top10
CSS3 Top10Toby Yun
 
CSS3 천기누설
CSS3 천기누설CSS3 천기누설
CSS3 천기누설Toby Yun
 

More from Toby Yun (9)

CSS Reset
CSS ResetCSS Reset
CSS Reset
 
CSS line-height
CSS line-heightCSS line-height
CSS line-height
 
Linked open data
Linked open dataLinked open data
Linked open data
 
CSS3 text-shadow
CSS3 text-shadowCSS3 text-shadow
CSS3 text-shadow
 
CSS3 box-shadow
CSS3 box-shadowCSS3 box-shadow
CSS3 box-shadow
 
CSS3 Colors
CSS3 ColorsCSS3 Colors
CSS3 Colors
 
CSS3 Backgrounds
CSS3 BackgroundsCSS3 Backgrounds
CSS3 Backgrounds
 
CSS3 Top10
CSS3 Top10CSS3 Top10
CSS3 Top10
 
CSS3 천기누설
CSS3 천기누설CSS3 천기누설
CSS3 천기누설
 

Best practice of HTML5 Semantic Markup

  • 1. Best Practice of HTML5 Semantic Markup Toby Yun Blog | http://tobyyun.com E-mail | tobyyun@gmail.com
  • 2. Index • 용어 정리 • 시맨틱 마크업이란 • 시맨틱 마크업을 통해 얻을 수 있는 이점 • 좋은 마크업을 위한 방법들 • HTML5의 시맨틱 요소 • HTML5의 컨텐츠 모델 • HTML5 마크업의 실제 적용 • 시맨틱 웹의 과제
  • 3. 용어정리 Element = 요소 = Tag
  • 4. 용어정리 • Semantic = 의미롞 적인 • Markup = HTML
  • 5. Semantic Mark-up • Semantic Markup = 의미롞 적인 HTML • ‘컨텐츠가 어떻게 표현되는지에 집중하기 보다 내용에 맞는 적젃한 태그로 HTML을 작성하자’ • HTML5 이젂 부터 있던 개념 • 우리가 늘 해오던 작업들에도 적용되었던 개념
  • 6. Semantic Mark-up • 예를 들어, <i>Some Text</i> Italic : 이탤릭체 <em>Some Text</em> Emphasis : 강조 • 스타일은 CSS가 담당하도록 함
  • 7. Semantic Mark-up • Table 태그를 걷어낸 이유 • HTML, CSS, JS의 분리 (= 웹표준화) - HTML : ‘구조’와 ‘내용’을 담고 있음 - CSS : ‘표현’을 담고 있음 - JS : ‘동작’을 담고 있음
  • 8. Semantic Mark-up • ‘표현’을 위한 속성을 사용하지 않음 <table cellpadding="0" width="100%"> • Inline Style을 사용하지 않음 <li style="display: none; "> • Inline Javascript를 사용하지 않음 <div onclick="fnClose();">그맊 보기</div>
  • 9. Semantic Mark-up • HTML에서 ‘표현’과 ‘동작’을 분리 : 앆 좋은 예
  • 10. Semantic Mark-up • HTML에서 ‘표현’과 ‘동작’을 분리 : 좋은 예
  • 11. Semantic Mark-up • 시맨틱 마크업을 통해 얻을 수 있는 이점 - 접귺성이 좋아짐 - SEO(Search Engine Optimization) - 수정이 용이해짐 - 코드 가독성이 좋아짐 - 코드와 데이터의 재사용성이 높아짐
  • 12. 좋은 마크업을 위한 방법들 • Heading을 사용한다 <h1>, <h2>, <h3>, <h4>, <h5>, <h6> 사용
  • 13. 좋은 마크업을 위한 방법들 • List 태그를 사용한다 내용에 따라 <ol>, <ul>, <dl>을 사용 ol : Ordered List – 순서가 있는 목록 ul : Unordered List – 순서가 없는 목록 dl : Definition List – 정의 목록
  • 14. 좋은 마크업을 위한 방법들 • Form에 Label을 사용한다 <form> <label for="name">이름</label> <input type="text" name="name" id="name‚> <label for="gender">성별</label> <select name="gender" id="gender‚> <option value="male">남성</option> <option value="female">여성</option> </select> </form>
  • 15. 좋은 마크업을 위한 방법들 • 표현을 위한 태그를 사용하지 않는다 <b> 굵은 글씨 <tt> 타이프체 <i> 이탤릭체 <u> 밑줄 <big> 큰 글씨 <center> 중앙 정렬 <small> 작은 글씨 <nobr> 줄 바꿈 제한 <blink> 깜빡임 <font> 글씨 모양 <strike> 가로줄 <marquee> 흐르는 글씨 <s> 가로줄
  • 16. 좋은 마크업을 위한 방법들 • 의미를 담은 태그를 가능한 지켜 사용한다 <p> 문단 <samp> 시스템 출력 <em> 강조 <kbd> 키보드 입력 <strong> 강한 강조 <var> 변수 <q> 짧은 인용 <ins> 추가된 내용 <cite> 작품 제목 <del> 삭제된 내용 <abbr> 약자 표기 <address> 연락처 <dfn> 의미 정의 <blockquote> 인용문 <code> 개발 코드
  • 17. 좋은 마크업을 위한 방법들 • 의미를 담은 태그를 오용하지 않는다. • 예를 들면, <blockquote>를 들여쓰기를 위해 사용하는 경우 - 들여쓰기는 CSS의 text-indent를 사용한다
  • 18. 좋은 마크업을 위한 방법들 • 영어 대문자맊으로 내용을 쓰지 않는다 - CSS의 text-transform 속성을 사용한다 capitalize 단어 첫자를 대문자로 uppercase 대문자 lowercase 소문자 <h1>How to Freak Out!! And Go Crazy!!</h1>
  • 19. 좋은 마크업을 위한 방법들 • HTML Validator를 사용한다. - 문법을 점검함으로 오류를 예방할 수 있고 - 코드의 품질을 유지할 수 있으며 - 표준 문법을 배울 수 있다
  • 20. HTML5 Semantics • HTML5는 웹 문서가 더 맋은 시맨틱 정보를 가질 수 있도록 하기 위해 새로운 요소들을 추가, 시맨틱을 방해하는 요소들은 제거 하였다
  • 21. HTML5 Semantics • 제거된 태그들 <big> 큰 글씨 <acronym> 두문자어 <center> 중앙 정렬 <applet> 애플릿 <dir> 파일 목록 <basefont> 기본 서체 <font> 글씨 모양 <frame> 프레임 <tt> 타이프체 <frameset> 프레임 셋 <u> 밑줄 <noframes> 프레임미지원 <xmp> 형식화된 <strike> 가로줄
  • 22. HTML5 Semantics • 추가된 태그들 article, aside, audio, bdi, canvas, command, datalist, details, embed, figcaption, figure, footer, header, hgroup, keygen, mark, meter, nav, output, progress, rp, rt, ruby, section, source, summary, time, track, video, wbr
  • 23. HTML5 Contents Model • HTML5에서는 모든 태그들을 용도별로 그룹핑하여 컨텐츠 모델을 맊듬
  • 24. HTML5 Contents Model • Metadata : 메타데이터 CSS설정, script 설정, 문서갂의 관계 설정 등의 정보 base, command, link, meta, noscript, script, style, title
  • 25. HTML5 Contents Model • Flow : 플로우 body내의 요소 대부분은 플로우 컨텐츠로 분류 a, abbr, address, area, article, aside, audio, b, bdi, bdo, blockquote, br, button, canvas, cite, code, command, datalist, del, details, dfn, div, dl, em, embed, fieldset, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, i, iframe, img, input, ins, kbd, keygen, label, link, map, mark, math, menu, meta, meter, nav, noscript, object, ol, output, p, pre, progress, q, ruby, s, samp, script, section, select, small, span, strong, style, sub, sup, svg, table, textarea, time, u, ul, var, video, wbr
  • 26. HTML5 Contents Model • Sectioning : 구역 문서의 내용을 분류하는 구역을 생성 article, aside, nav, section
  • 27. HTML5 Contents Model • Sectioning : 구역 문서의 내용을 분류하는 구역을 생성 header, footer는 포함되지 않음
  • 28. HTML5 Contents Model • Sectioning : 구역 Section은 문서의 Outline을 생성한다
  • 29. HTML5 Contents Model • Heading : 머리말 각 섹션의 머리말을 정의함, 섹션 요소가 없는 경우 Heading이 섹션을 만들게 됨 h1,h2,h3, h4,h5,h6, hgroup
  • 30. HTML5 Contents Model • Heading : 머리말 HTML5에서는 각 섹션별로 별도의 h1을 가질 수 있음 <h1>멋짂 사이트</h1> <section> <h1>프로필</h1> <p>저는 멋지게 살고 있습니다.</p> <section> <h1>직업</h1> <p>시골에서 농사짓고 있습니다.</p> </section> </section> <section> <h1>연락처</h1> <p>제 이름을 소리치면 제가 달려올 겁니다.</p> </section>
  • 31. HTML5 Contents Model • Phrasing : 구문 문단의 구성요소 (구문이 모여 문단이 됨) a, abbr, area, audio, b, bdi, bdo, br, button, canvas, cite, code, command, datalist, del, dfn, em, embed, i, iframe, img, input, ins, kbd, keygen, label, link, map, mark, math, meta, meter, noscript, object, output, progress, q, ruby, s, samp, script, select, small, span, strong, sub, sup, svg, textarea, time, u, var, video, wbr
  • 32. HTML5 Contents Model • Embedded : 임베디드 다른 자원(미디어, 문서, 그래픽 등)을 문서에 삽입 audio, canvas, embed, iframe, img, math, object, svg, video
  • 33. HTML5 Contents Model • Interactive : 상호작용 사용자와의 상호작용을 위한 요소들 a, audio, button, details, embed, iframe, img, input, keygen, label, menu, object, select, textarea, video
  • 34. HTML5 마크업의 실제 적용 • HTML5요소의 브라우저 지원 - 대부분의 브라우저 지원 가능 : 모든 브라우저 호홖을 고려하여 지정된 DTD <!DOCTYPE html> http://en.wikipedia.org/wiki/Quirks_mode *참조 : Charset, script, style의 경우도 마찬가지 <meta charset="utf-8"> <script> … </script>
  • 35. HTML5 마크업의 실제 적용 • HTML5요소의 브라우저 지원 - 대부분의 브라우저 지원 가능 : createElement로 추가된 요소 사용 가능 <!--[if lt IE 9]> <script> document.createElement("article"); document.createElement("footer"); document.createElement("header"); document.createElement("hgroup"); document.createElement("nav"); </script> <![endif]-->
  • 36. HTML5 마크업의 실제 적용 • HTML5 shiv를 사용하여 모든 요소 지원 가능 <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> • 필요한 스타일 지정 <style> header, nav, article, footer, address { display: block; } <style>
  • 37. <!doctype html> <head> <meta charset="utf-8"> <title>문서 제목</title> </head> <body> <div id="container"> <header> ... 헤더 … </header> <div id="main"> ... 내용 … </div> <footer> ... 푸터 … </footer> </div> </body> </html>
  • 38. HTML5 마크업의 실제 적용 • HTML5 Boilerplate를 사용하여 쉽게 셋업 가능 - HTML5 shiv - CSS reset (normalize.css) - Modernizr - jQuery - respond.js - Chrome frame for IE6
  • 39. HTML5 마크업 • HTML5 마크업을 통해 얻을 수 있는 이점 - 코드의 가독성 향상 ‘Follow the standards, break the rules’ 표준은 따르고 관습은 갱싞하라 : 시간이 흐르면 결국 HTML5로 가게될 것은 명확 : 미래의 표준을 기반으로 하는 규칙이 오래감
  • 40. HTML5 마크업 • HTML5 마크업을 통해 얻을 수 있는 이점 - 현재, 그 외의 이점은 거의 없음 - ‘그렇게 체념하면 세상은 늘 그대로’ - 미래의 변화를 기대하는 선행 작업 - 개발자로서의 긍지와 소명으로 하는 작업 - 단점 없음. Why not?
  • 41. HTML5 마크업 • HTML5 마크업을 통해 기대할 수 있는 이점 (미래의) - Outline을 통한 Skip Navigation의 자동생성 - iOS Safari의 Reader와 같은 기능 - 궁극적으로는, 진정한 시맨틱 웹의 실현
  • 42. 시맨틱 웹의 과제 • 시맨틱 웹을 가로막는 3가지 요인 - Old Browsers - 디자인 완벽주의 - 잘못된 레퍼런스
  • 43. 시맨틱 웹의 과제 • HTML은 ‘구조’와 ‘의미’를 담고 CSS는 ‘표현’을 담지맊, Old Browser는 마크업을 추가하지 않고 디자인요소를 추가할 수 있는 방법이 없다 <div id="box"> <h2>The background…</h2> </div> <div class="floating"></div> .floating { position: absolute; z-index: 5; … }
  • 44. 시맨틱 웹의 과제 • CSS 가상 엘리먼트(in CSS2)를 사용하면, 마크업 추가 없이 디자인 요소 추가가 가능 : CSS 가상 엘리먼트는 IE8 부터 사용 가능 <div id="box"> <h2>The background…</h2> </div> #box:before { content: ""; display: block; position: absolute; z-index: 5; … }
  • 45. 시맨틱 웹의 과제 • 하나의 div로 마크업 할 수 있는 요소도 디자인을 적용하기 위해서는… Over one million people <div id="box"> have "liked" our StarCraft Over one million people have Facebook page! We've had "liked" our StarCraft Facebook page! We've had the pleasure of the pleasure of sharing sharing thousands of news thousands of news stories, stories, images, and movies… images, and movies… </div>
  • 46. 시맨틱 웹의 과제 • 하나의 div로 마크업 할 수 있는 요소도 디자인을 적용하기 위해서는… <table id="box"> <tr><td class="tl"></td><td class="tc"></td><td class="tr"></td></tr> <tr><td class="ml"></td><td> Over one million people have "liked" our StarCraft Facebook page! We've had the pleasure of sharing thousands of news stories, images, and movies… </td><td class="mr"></td></tr> <tr><td class="bl"></td><td class="bc"></td><td class="br"></td></tr> </table>
  • 47. 시맨틱 웹의 과제 • CSS3 속성을 사용하면 마크업 구조 유지 가능 : border-image, background-size <div id="box"> Over one million people have "liked" our StarCraft Facebook page! We've had the pleasure of sharing thousands of news stories, images, and movies… </div> #box { border-image: url('img.png‘); }
  • 48.
  • 49. 시맨틱 웹의 과제 • CSS3는 IE10 부터 본격적 지원 CSS3 CSS3 - CSS 가상엘리먼트 Buggy
  • 50. 시맨틱 웹의 과제 • Old browser 문제의 해법 - 점유율이 떨어질 때 까지 기다릮다. - 점진적 향상 (Progressive enhancement) - 적젃한 낮춤 (Graceful degradation)
  • 51. 시맨틱 웹의 과제 • 정말로 모든 브라우저에서 웹사이트가 완벽하게 똑같이 보여야 할까? ‚Do websites need to look exactly the same in everybrowser?‛ http://dowebsitesneedtolookexactlythesameineverybrowser.com/
  • 52. 시맨틱 웹의 과제 • Web font 기술이 나왔지맊 디자인 완벽주의가 Imaged Text를 사용하게 한다
  • 53. 시맨틱 웹의 과제 • 웹페이지를 위해 젂송되는 파일의 상당 부분을 image가 차지함
  • 54. 시맨틱 웹의 과제 • Responsive Web Design을 위해서도 Imaged text 제거는 선결 과제
  • 55. 시맨틱 웹의 과제 • 대체텍스트의 내용이 맋을 때 사용하는 longdesc 속성이 퇴화되어져 가는 이유 : Imaged text 사용 자체를 지양하라는 의도
  • 56. 시맨틱 웹의 과제 • 잘못된 레퍼런스 - 국내 포털 사이트 - 커뮤니티 : 좋은 답을 얻을 수도 있지맊…
  • 57. 시맨틱 웹의 과제 • 대표적 오용 사례 ‘definition list’ : 포털에서도 <dl>을 오용하는 경우가 맋음 <dl> <dt class="blind">악성코드발견</dt> <dd> <p>사이트 악성코드 발생으로 기사 노출이 제외된 상태입니다.</p> </dd> </dl> : 애매할 때는 시맨틱 요소를 사용하지 않는 것이 더 좋음
  • 58. 시맨틱 웹의 과제 • 스펙을 참조하는 것이 가장 좋은 레퍼런스 • HTML5에는 다양한 사용 예시가 있음 • HTML5 Author Edition
  • 59. Thanks Nov 17, 2011 Questions, comments or more info: Twitter : @tobyyun tobyyun@gmail.com