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

วิธีใช้ Attribute href ในหน้า HTML

Attribute href ในหน้า HTML ใช้ระบุ URL สำหรับหน้าเว็บ หากไม่มี attribute href แท็ก <a> จะไม่ถูกนับเป็น hyperlink

จำไว้ว่า attribute href ควรถูกรวมเป็น attribute สำหรับแท็ก <a> ควรใช้ภายในแท็ก <body>...</body>

วิธีใช้ Attribute href ในหน้า HTML

ตัวอย่าง

<!DOCTYPE html> 
<html> 
  <head> 
    <title>HTML href attribute</title> 
  </head> 
  <body> 
    <h1>Learn about the company</h1> 
    <a href="/about/index.htm">About</a> 
    <a href="/about/about_team.htm">Team</a> 
  </body> 
</html>

ผลลัพธ์

วิธีใช้ Attribute href ในหน้า HTML