การเขียน HTML
แนะนำใหม่| English | ความหมาย |
|---|---|
| HTML/ˌeɪtʃ tiː em ˈel/ | HTML |
| attribute/ˈætrɪbjuːt/ | คุณสมบัติ |
| element/ˈelɪmənt/ | องค์ประกอบ |
| semantic elements/səˈmæntɪk ˈelɪmənts/ | องค์ประกอบเชิงความหมาย |
It looks like a link, but Tab skips it
- A styled rectangle saying “Join” is not automatically a working link. A real anchor with a destination has browser behaviour that styling alone does not supply.
- HTML 超文本标记语言 gives content structure and meaning. CSS controls presentation; choosing meaningful HTML also supports keyboard and assistive-technology use.
ทำไมต้องใช้heading element จริงสำหรับหัวข้อหน้า?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
heading อธิบายโครงสร้างของเอกสาร ส่วนรูปลักษณ์สามารถควบคุมได้ผ่าน CSS
Read the tag and its attributes
- An element 元素 often has a start tag, content and an end tag:
<p>Meet on Thursday.</p>. An attribute 属性 supplies information in the start tag:<a href="join.html">Join</a>. - An HTML void element such as
imghas no end tag or child content. It does not “close itself”; a trailing slash is unnecessary in HTML. Nest paired tags without crossing them.
attribute ใดที่ระบุตำแหน่งการนำทางให้กับ anchor?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
anchor เช่น วิธีการสมัคร ใช้ href
Mark the page regions by purpose
- Semantic elements 语义化元素 include
navfor major navigation andmainfor the page's main content. Use headings to describe sections anddivfor a generic grouping when no more specific element fits. - A native
awithhrefnavigates; a nativebuttonperforms an action. Semantic markup helps, but labels, behaviour and focus still need testing.

elements ใดมีความหมายเฉพาะของ HTML เหล่านี้? เลือกทุกข้อที่ถูกต้อง
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
div เป็น element แบบทั่วไป ใช้งาน element ที่เจาะจงกว่าเมื่อวัตถุประสงค์ที่กำหนดตรงกัน
จับคู่วัตถุประสงค์ที่ต้องการกับ native element ที่เหมาะสม
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
องค์ประกอบพื้นถิ่นให้ความหมายและพฤติกรรมเริ่มต้น ซึ่งยังต้องการฉลากที่ใช้งานได้และการทดสอบ
Build a small complete page
- Save this example as
index.htmlbeside a realjoin.html. Open it in a browser and follow the link using Tab and Enter. langidentifies the page language;titlenames the browser tab. The viewport setting lets responsive styles use the device width.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Robotics club</title>
</head>
<body>
<nav aria-label="Main"><a href="join.html">How to join</a></nav>
<main>
<h1>Robotics club</h1>
<p>Meet Thursday at 4 pm in room 12.</p>
</main>
</body>
</html>
<a href="join.html">How to join</a> combines a destination and a useful label. <div class="link">Click here</div> provides neither native navigation nor a destination.
Choose alternatives by the image's purpose
- An informative image needs an alternative conveying its relevant meaning. A purely decorative image normally uses
alt=""so assistive technology can skip it. - For an image used as a link, describe the link's function when that information is not otherwise supplied. A complex chart also needs its important data explained in text.
Do not use headings merely to enlarge text, or repeat “image” as every alternative. Equally, do not give decorative images lengthy descriptions that interrupt the page.
แผนภูมิที่มีข้อมูลจำเป็นต้องมีคำอธิบายทางเลือกที่สื่อความหมายสำคัญ ไม่ใช่แค่คำว่า “ภาพ” เท่านั้น
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
ถูกต้อง คำอธิบายทางเลือกต้องให้ข้อมูลที่เกี่ยวข้อง แผนภูมิที่ซับซ้อนอาจจำเป็นต้องมีข้อมูลสำคัญแสดงเป็นข้อความเพิ่มเติมด้วย
ข่าวจากชมรมใช้ภาพถ่ายเพื่อแสดงนักเรียนกำลังปลูกต้นไม้ในสนามโรงเรียน เขียน alt text ที่มีประโยชน์
ความยาก 3/5 · 200 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
ตัวอย่าง: “นักเรียนกำลังปลูกต้นไม้ในสนามโรงเรียน” อย่าเพิ่มจำนวนที่ไม่ได้ระบุมา
ลายเส้นตกแต่งเล็กๆ ข้างหัวข้อไม่เพิ่มข้อมูลใด ๆ ภาพทางเลือกใดที่ควรใช้แทนโดยปกติ?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
การวางค่าว่างในภาพทางเลือกช่วยให้เทคโนโลยีช่วยอ่านข้ามรูปภาพที่ตกแต่งเพียงอย่างเดียวได้
Verify structure and behaviour
- Check the heading order, meaningful link labels, keyboard use and image alternatives. An HTML validator can detect markup errors, but cannot judge whether your wording is useful.
- Make the meeting page usable with styles turned off. Then style the content without changing headings into appearance-only shortcuts.
Choose HTML by purpose. Use native links and buttons, valid nesting and image alternatives that match the image's role.
Sources: HTML syntax and W3C decorative images.
ใน HTML, img เป็นองค์ประกอบแบบว่าง (void element) และห้ามใช้แท็กปิด
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
องค์ประกอบว่างเปล่าไม่มีเนื้อหาลูกหรือแท็กปิด ไม่จำเป็นต้องมีสแลชท้าย มันไม่ได้ให้ behavior self-closing กับองค์ประกอบ HTML