Trang chủ
CSS
CSS phù hợp với đối tượng
Tryit: Thuộc tính phù hợp với đối tượng - tất cả các giá trị
Chạy ❯
Nhận trang web của
riêng
bạn
×
Thay đổi định hướng
Lưu mã
Thay đổi chủ đề, Tối/Sáng
Đi tới Không gian
<!DOCTYPE html> <html> <head> <style> .fill {object-fit: fill;} .contain {object-fit: contains;} .cover {object-fit: cover;} .scale-down {object -fit:scale-down;} .none {object-fit: none;} </style> </head> <body> <h1>Thuộc tính object-fit</h1> <h2>Không có object-fit:< /h2> <img src="paris.jpg" alt="Paris" style="width:200px;height:300px"> <h2>object-fit: fill (đây là mặc định):</h2> <img class ="fill" src="paris.jpg" alt="Paris" style="width:200px;height:300px"> <h2>object-fit: contains:</h2> <img class="contain" src= "paris.jpg" alt="Paris" style="width:200px;height:300px"> <h2>object-fit: cover:</h2> <img class="cover" src="paris.jpg" alt ="Paris" style="width:200px;height:300px"> <h2>object-fit:scale-down:</h2> <img class="scale-down" src="paris.jpg" alt=" Paris" style="width:200px;height:300px"> <h2>object-fit: none:</h2> <img class="none" src="paris.jpg" alt="Paris" style="width :200px;height:300px"> </body> </html>