หากต้องการจัดกึ่งกลางรูปภาพ ให้ใช้ display: block ร่วมกับ margin-left: auto และ margin-right: auto
ตัวอย่าง
<!DOCTYPE html> <html> <head> <style> img { border: 2px solid orange; border-radius: 3px; padding: 7px; } img { display: block; margin-left: auto; margin-right: auto; width: 50%; } </style> </head> <body> <img src = "https://www.tutorialspoint.com/videotutorials/images/coding_ground_home.jpg" alt="Online Compiler" width="300" height="300"> </body> </html>