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

ลดขนาดรูปภาพให้ Responsive ด้วย CSS

หากต้องการทำให้รูปภาพ responsive ให้ใช้ max-width: 100% และ height: auto

ตัวอย่าง

<!DOCTYPE html> <html>    <head>       <style>          img {             max-width: 100%;             height: auto;          }       </style>    </head>    <body>       <img src = "https://www.tutorialspoint.com/videotutorials/images/coding_ground_home.jpg" alt = "Online Compiler" width = "300" height = "300">    </body> </html>