CSS Aspect Ratio - Practical Example

Publicado el: 01 febrero 2021
en el canal de: A shot of code
476
19

The CSS aspect-ratio property is a new addition to CSS that allows us to enforce the correct sizing of items that don't have an intrinsic size. A good example here would be a you tube video embedded into a website using an iFrame. This tutorial video looks at that exact scenario and first checks out the current padding-top 'hack' that is utilized today to perform this. And then how to use the new aspect-ratio to replace this. The reduced clutter from using aspect-ratio and also the clarity that it provides is self evident at this point.

It should be noted that as of the time of this video the property is only available in chrome 88, but is implemented in Safari and Firefox behind a flag so will be covered in all major browsers in the near future.,

Reference to other information on aspect ratio:

https://css-tricks.com/aspect-ratio-b...

https://web.dev/aspect-ratio/

And for Beagle lovers the SmudgeTheBeagle youtube site!

   / smudgethebeagle  


En esta página del sitio puede ver el video en línea CSS Aspect Ratio - Practical Example de Duración hora minuto segunda en buena calidad , que subió el usuario A shot of code 01 febrero 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 476 veces y le gustó 19 a los espectadores. Disfruta viendo!