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

การจัดแนวตั้งภาพแนวดิ่งด้วย CSS


คุณสมบัติ vertical-align

ใช้ vertical-align เพื่อจัดตำแหน่งภาพเทียบกับข้อความรอบๆ ค่าที่นิยม: baseline, top, middle, bottom, text-top, text-bottom

ตัวอย่าง

<!DOCTYPE html>
<html>
<head>
  <style>
    img {
      vertical-align: text-bottom;
    }
  </style>
</head>
<body>
  <p>This is <img src="https://www.tutorialspoint.com/videotutorials/assets/videos/courses/155/images/course_155_image.png" alt="Video Tutorial" width="200" height="150"> demo image.</p>
</body>
</html>