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

วิธีใช้ Attribute Height และ Width ของภาพใน HTML

เพื่อเพิ่มภาพในหน้า HTML ใช้แท็ก <img> พร้อมกับ attributes height และ width เพื่อตั้งค่าความสูงและความกว้างของภาพในหน่วยพิกเซล จำไว้ว่าควรระบุทั้งสอง attributes นี้เสมอ

วิธีใช้ Attribute Height และ Width ของภาพใน HTML

ตัวอย่าง

<!DOCTYPE html> 
<html> 
  <head> 
    <title>HTML Document</title> 
  </head> 
  <body> 
    <img src = ”/green/images/logo.png” alt = "We Learners" width = ”170” height = ”70”> 
  </body> 
</html>