Day 12. Rounding up the CSS Grids Course
October 14, 2019
Notes
- object-fit: The CSS object-fit property is used to specify how an
<img>
or<video>
should be resized to fit its container. - This property tells the content to fill the container in a variety of ways; such as “preserve that aspect ratio” or “stretch up and take up as much space as possible”.
- Instead of letting images be distorted on different viewport sizes, we can set up the image to look good on all screens by specifying the object-fit property.
- Values are
fill
,contain
,cover
,none
,scale-down
. All Values of The CSS object-fit Property - Array.from() takes a string or another array and returns a new array. If the argument is a string, it’s converted to an array with the string characters as elements of the array.
- If the argument is an array, it returns another array with the elements of the previous array.
- If the argument is a literal, it returns an array with the literal as elements.
- It can also take an additional property, a function to run on every argument.
grid-auto-flow
is the exact equivalent toflex-direction
in CSS Grid. The default isgrid-auto-flow: row
. Other values aregrid-auto-flow: column
andgrid-auto-flow: row dense
orgrid-auto-flow: column dense
;- We can use a shorthand for
grid-template-rows
,grid-template-columns
withgrid-template : 1fr 1fr / 1fr 1fr
; - Before and after elements are considered grid items on a grid parent…