HTML <input> altแอตทริบิวต์
ตัวอย่าง
แบบฟอร์ม HTML ที่มีรูปภาพแทนปุ่มส่ง:
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname">
<input type="image" src="submit.gif" alt="Submit" width="48" height="48">
</form>
ความหมายและการใช้งาน
แอตทริบิวต์alt
จัดเตรียมข้อความสำรองสำหรับผู้ใช้ หากเขา/เธอไม่สามารถดูภาพได้ด้วยเหตุผลบางประการ (เนื่องจากการเชื่อมต่อช้า ข้อผิดพลาดในแอตทริบิวต์ src หรือหากผู้ใช้ใช้โปรแกรมอ่านหน้าจอ)
หมายเหตุ:แอตทริบิวต์alt
สามารถใช้ได้กับ
<input type="image">
.
รองรับเบราว์เซอร์
Attribute | |||||
---|---|---|---|---|---|
alt | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
<input alt="text">
ค่าแอตทริบิวต์
Value | Description |
---|---|
text | Specifies an alternate text for the image |
❮ แท็ก HTML <input>