Search
 
SCRIPT & CODE EXAMPLE
 

CSS

object-fit

/* Valeurs avec un mot-clé */
object-fit: fill;
object-fit: contain;
object-fit: cover;
object-fit: none;
object-fit: scale-down;

/* Valeurs globales */
object-fit: inherit;
object-fit: initial;
object-fit: unset;
Comment

object fit css

img {
  width: 200px;
  height: 
  400px;
  object-fit: cover;
} 
Comment

object-fit values in css

img{
  object-fit: cover|contain|fill|none|scale-down;
}
Comment

object-fit

  object-fit: fill;
  object-fit: contain;
  object-fit: none;
  object-fit: scale-down;
Comment

object fit cover


img {
  width: 200px;
  height: 
  400px;
  object-fit: cover;
} 
Comment

CSS The object-fit Property

img {
  width: 200px;
  height: 300px;
  object-fit: cover;
}
Comment

object-fit: cover;

/*image cover*/
object-fit: cover; 
/*image perfect size css html*/
Comment

object fit css

background image to fit inside container which maintaining dimensions.
Comment

example for object fit in css

<section>
  <h2>object-fit: fill</h2>
  <img class="fill" src="mdn_logo_only_color.png" alt="MDN Logo">

  <img class="fill narrow" src="mdn_logo_only_color.png" alt="MDN Logo">

  <h2>object-fit: contain</h2>
  <img class="contain" src="mdn_logo_only_color.png" alt="MDN Logo">

  <img class="contain narrow" src="mdn_logo_only_color.png" alt="MDN Logo">

  <h2>object-fit: cover</h2>
  <img class="cover" src="mdn_logo_only_color.png" alt="MDN Logo">

  <img class="cover narrow" src="mdn_logo_only_color.png" alt="MDN Logo">

  <h2>object-fit: none</h2>
  <img class="none" src="mdn_logo_only_color.png" alt="MDN Logo">

  <img class="none narrow" src="mdn_logo_only_color.png" alt="MDN Logo">

  <h2>object-fit: scale-down</h2>
  <img class="scale-down" src="mdn_logo_only_color.png" alt="MDN Logo">

  <img class="scale-down narrow" src="mdn_logo_only_color.png" alt="MDN Logo">
</section>
Comment

object-fit

/* The object-fit CSS property sets how the content of a replaced 
element, such as an <img> or <video>, 
should be resized to fit its container. 

The position of the replaced element can be affected using CSS,
but not the contents of the replaced element itself.
Some replaced elements, such as <iframe> elements,
may have stylesheets of their own, but they don't inherit the styles
of the parent document. */

/* Global */
object-fit: inherit;
object-fit: initial;
object-fit: revert;
object-fit: unset;

/* VALUES */

object-fit: contain;

/*
The replaced content is scaled to maintain its aspect ratio while fitting
within the element’s content box. The entire object is made to fill the
box, while preserving its aspect ratio, so the object will be 
"letterboxed" if its aspect ratio does not match the aspect ratio
of the box.
*/

object-fit: cover;

/*
The replaced content is sized to maintain its aspect ratio
while filling the element’s entire content box. 
If the object's aspect ratio does not match the aspect ratio of its box,
then the object will be clipped to fit.
*/

object-fit: fill;

/*
The replaced content is sized to fill the element’s content box.
The entire object will completely fill the box. 
If the object's aspect ratio does not match the aspect ratio of its box,
then the object will be stretched to fit.
*/

object-fit: none;
/*
The replaced content is not resized.
*/

object-fit: scale-down;

/*
The content is sized as if none or contain were specified, 
whichever would result in a smaller concrete object size.
*/
Comment

PREVIOUS NEXT
Code Example
Css :: css font properties 
Css :: button edges rounded css 
Css :: positioning button inside div 
Css :: rotate z axis css 
Css :: chenge number of lines of text in css 
Css :: how to put a black overlay on a photo css 
Css :: scroll bar with 0 width 
Css :: how to center a div element 
Css :: css background darker 
Css :: css add shade over background image 
Css :: canvas disable antialiasing 
Css :: css change text size 
Css :: how to change image based on screen size 
Css :: css text alignment 
Css :: svg stroke color 
Css :: css hide scrollbar 
Css :: css layers over background-images 
Css :: css background image shown on top right 
Css :: circle css w3schools 
Css :: text-overflow: ellipsis 2 lines 
Css :: css profile picture round 
Css :: how to make a relative div not take up space 
Css :: css keyframes 
Css :: css text highlight 
Css :: type selector css 
Css :: put a border only on bottom 
Css :: glass css 
Css :: website css not loading 
Css :: add expanding underline on page load css 
Css :: responsive website css 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =