-
Notifications
You must be signed in to change notification settings - Fork 36
Using :after #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey! I think the biggest con is that this doesn't work with images as far as I know, since they can't have after/before elements and images are where I use aspect ratios the most. |
Hey! Thank you for your suggestion! Going to amend on Adam's comment. Since it doesn't work with images, I think the best solution for now is to keep it as is. It's currently also a separate plugin. I see a future where we stop using this plugin and move it into the core of tailwind once native aspect-ratio works: https://caniuse.com/mdn-css_properties_aspect-ratio Here is a reproduction with your proposed code that showcases the issue that Adam mentioned regarding images: https://play.tailwindcss.com/dqPLINPKIm Going to close this for now. If you happen to find a solution that can be applied on the same element and works for images as well then we would be very happy to see if we can implement it that way! |
Yeah, sure it doesn't work directly on images without a parent element. Thanks for the attention and the quick reply. Wish you all the best! |
Hey @adamwathan , thanks for your great work!
I just wanted to ask if you have considered using
:after
element for the padding and what key points made you decide against it?I usually go with something like this:
The pros of course are that we don't need an extra parent element.
I assume one con is that u cannot target the
:after
element with other utilities, also this way the selector is a bit stronger, but, while this is subjective, I cannot think of a common enough scenario that this would be a problem. Anyway you made it with purpose and I am just curious 😊The text was updated successfully, but these errors were encountered: