-
-
Notifications
You must be signed in to change notification settings - Fork 635
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
Media Queries for css helper #1903
Comments
Hi @peterver Thanks for using "hono/css" right away. And thanks for the suggestion. So the CSS generated from the following statement should work for media queries const mq_class = css`
@media screen and (min-width: 767px) {width: 100%};
`; // => .css-1857464094{@media screen and (min-width:767px){width:100%}} For older web browsers, I would think a conversion like you suggest would be needed, do you need support for older web browsers? |
Hi @usualoma it indeed worked when I tested locally on chrome, I was getting different results on some test devices with mobile safari though. Given that nesting is still in working draft how would one go about adding support for the below? (I wouldn't mind taking a stab at a PR myself) :) For now I've settled on using a class and adding them manually. A possible suggestion I had would be to be able to reserve a generated css class and being able to use it manually, currently I'm adding my media queries like this in a component (example):
I previously tried the following but that only worked once as it always generates the same class:
|
Thanks for the response. Well... Currently web browser support for CSS Nesting is a little over 80%, but I expect that number to rise considerably this year. We also don't want to make "hono/css" more complicated than necessary since all browsers have completed implementation in their latest versions and I think it is unlikely to be obsolete in the future. If we were to make any modifications, we would keep the default to the current behavior and provide an optional means of resolving nesting. The following project does not seem to be working correctly, but a solution in the form of a polyfill like this may be useful. |
What is the feature you are proposing?
I've been using the css helper and though it works quite well 🚀 I would love to request the possibility to generate standards-compliant media queries with it.
For example when using the css helper to do the following:
the following would currently be generated:
maybe by usage of some kind of marker we could end up generating the following:
The text was updated successfully, but these errors were encountered: