Skip to content

Instantly share code, notes, and snippets.

@danestves
Created February 13, 2020 22:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danestves/21715476e6875c69da8a40f8ce0c08c5 to your computer and use it in GitHub Desktop.
Save danestves/21715476e6875c69da8a40f8ce0c08c5 to your computer and use it in GitHub Desktop.
Aspect Radios to use with tailwindcss
.embed-responsive {
@apply relative;
}
.embed-responsive::before {
@apply block;
content: "";
}
.embed-responsive .embed-responsive-item,
.embed-responsive iframe,
.embed-responsive embed,
.embed-responsive object,
.embed-responsive video {
@apply np-inset-0;
@apply np-absolute;
@apply min-w-full;
@apply h-full;
}
.aspect-21x9::before {
padding-top: 42.857143%;
}
.aspect-16x9::before {
padding-top: 56.25%;
}
.aspect-4x3::before {
padding-top: 75%;
}
.aspect-1x1::before {
padding-top: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment