Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

Microdata Vocabulary ใน HTML5 คืออะไร?


เพื่อกำหนด Microdata vocabulary คุณต้องการ namespace URL ที่ชี้ไปยังเว็บเพจที่ทำงานจริง เช่น https://data-vocabulary.org/Person สามารถใช้เป็น namespace สำหรับ vocabulary บุคคลพร้อมคุณสมบัติที่มีชื่อดังนี้:

  • name - ชื่อบุคคลเป็นสตริงง่ายๆ
  • photo - URL รูปภาพของบุคคล
  • url - เว็บไซต์ที่เป็นของบุคคลนั้น

ด้วยคุณสมบัติเหล่านี้ Microdata ของบุคคลอาจเป็นดังนี้:

<html>
  <body>
    <div itemscope>
      <section itemscope itemtype="https://data-vocabulary.org/Person">
        <h1 itemprop="name">Gopal K Varma</h1>
        <p>
          <img itemprop="photo" src="https://www.tutorialspoint.com/green/images/logo.png">
        </p>
        <a itemprop="url" href="#">Site</a>
      </section>
    </div>
  </body>
</html>