Object Fit - Tailwind CSS
Có thể bạn quan tâm
| Class | Styles |
|---|---|
| object-contain | object-fit: contain; |
| object-cover | object-fit: cover; |
| object-fill | object-fit: fill; |
| object-none | object-fit: none; |
| object-scale-down | object-fit: scale-down; |
Examples
Resizing to cover
Use the object-cover utility to resize an element's content to cover its container:
Containing within
Use the object-contain utility to resize an element's content to stay contained within its container:
Stretching to fit
Use the object-fill utility to stretch an element's content to fit its container:
Scaling down
Use the object-scale-down utility to display an element's content at its original size but scale it down to fit its container if necessary:
Using the original size
Use the object-none utility to display an element's content at its original size ignoring the container size:
Responsive design
Prefix an object-fit utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:
<img class="object-contain md:object-cover" src="/img/mountains.jpg" />Learn more about using variants in the variants documentation.
Từ khóa » Html Css Stretch Image To Fit Div
-
How To Auto-resize An Image To Fit Into A DIV Container Using CSS
-
Stretch Image To Fit 100% Of Div Height And Width - Stack Overflow
-
CSS Object-fit Property - W3Schools
-
How To Auto-resize An Image To Fit A Div Container Using CSS?
-
Make Image Stretch To Fit Div Code Example
-
Css Stretch Image To Fill Div Code Example - Code Grepper
-
How To Auto-Resize The Image To Fit An HTML Container - W3docs
-
Css Resize Image To Fit Div No Stretching - MaxInterview
-
How To Resize An Image In HTML?
-
Object-fit | CSS-Tricks
-
How To Scale And Crop Images With CSS Object-fit | DigitalOcean
-
How To Stretch A Background Image To Fit A Web Page - ThoughtCo
-
How To Fill A Box With An Image Without Distorting It - MDN Web Docs
-
Object-fit - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla