主页
CSS
CSS object-fit
Tryit:object-fit 属性 - 所有值
运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <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>The object-fit Property</h1> <h2>No object-fit:</h2> <img src="paris.jpg" alt="Paris" style="width:200px;height:300px"> <h2>object-fit: fill (this is default):</h2> <img class="fill" src="paris.jpg" alt="Paris" style="width:200px;height:300px"> <h2>object-fit: contain:</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>