跑步 ”
×
改变方向
在 Codepen 上打开
更改主题,深色/浅色
<!DOCTYPE html> <html> <head><meta http-equiv="content-security-policy" content="script-src 'none'"> <style> .fill {object-fit: fill;} .contain {object-fit: contain;} .cover {object-fit: cover;} .scale-down {object-fit: scale-down;} .none {object-fit: none;} </style> </head> <body> <h1>Свойство object-fit</h1> <h2>Нет object-fit:</h2> <img src="../images/paris.jpg" alt="Париж" style="width:200px;height:300px"> <h2>object-fit: fill (это по умолчанию):</h2> <img class="fill" src="../images/paris.jpg" alt="Париж" style="width:200px;height:300px"> <h2>object-fit: contain:</h2> <img class="contain" src="../images/paris.jpg" alt="Париж" style="width:200px;height:300px"> <h2>object-fit: cover:</h2> <img class="cover" src="../images/paris.jpg" alt="Париж" style="width:200px;height:300px"> <h2>object-fit: scale-down:</h2> <img class="scale-down" src="../images/paris.jpg" alt="Париж" style="width:200px;height:300px"> <h2>object-fit: none:</h2> <img class="none" src="../images/paris.jpg" alt="Париж" style="width:200px;height:300px"> </body> </html>