

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
CSS object-fit Property Values
The object-fit property in CSS is used to resize image or video to fit its container. It has the following values
- contain: Content is scaled to fit
- cover: clipped to fit
- fill: fills the content box.
Example
You can try to run the following code to implement object-fit property with the cover value.
<!DOCTYPE html> <html> <head> <style> .myimg { width:250px; height:350px; object-fit:fill; } </style> </head> <body> <h2>SWIFT</h2> <img class = "myimg" src = "https://www.tutorialspoint.com/assets/videos/courses/67/images/course_67_image.png" alt = "Python Data Science" width = "300" height = "200"> </body> </html>
- Related Questions & Answers
- CSS object-fit Property
- Crop Images in CSS with object-fit and object-position
- object-position Property in CSS
- Values of CSS overflow property
- Values for the CSS cursor property
- Perform calculations to determine CSS property values
- CSS Latest Updates - Inner & Outer Values of display Property
- CSS padding property
- CSS outline property
- CSS height property
- CSS width property
- CSS pitch property
- Orphans CSS Property
- CSS azimuth Property
- CSS stress property
Advertisements