Home
CSS
CSS object-fit
Tryit: The object-fit property - all values
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to 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>