argyleink / argyleink/open-props
Using container as custom media queries
- Dominant language
- HTML
- Stars
- 5.5k
- Forks
- 216
- PR merge metrics
- No merged PRs in 30d
Description
Do you see any problem handling custom media queries without the need of postcss preprocessor?
I thought something like this could do:
```
:root {
--is-below-xxs: false;
--is-below-xs: false;
--is-below-sm: false;
--is-below-md: false;
--is-below-lg: false;
--is-below-xl: false;
--is-below-xxl: false;
@media screen and (max-width: 240px) {
--is-below-xxs: true;
}
@media screen and (max-width: 360px) {
--is-below-xs: true;
}
@media screen and (max-width: 480px) {
--is-below-sm: true;
}
@media screen and (max-width: 768px) {
--is-below-md: true;
}
@media screen and (max-width: 1024px) {
--is-below-lg: true;
}
@media screen and (max-width: 1440px) {
--is-below-xl: true;
}
@media screen and (max-width: 1920px) {
--is-below-xxl: true;
}
}
```
Usage:
```
@container style(--is-below-xxs: true) {
/* ... */
}
```
I've checked the browser compatibility, and it seems fine: https://caniuse.com/?search=%40container
What do you think? I can try to make a pull request if you think it would be a good fit for the project.
Contributor guide
No contributing guide indexed for this repository
Research direction
No project file, test, or entry point is named. Start by reviewing the proposed custom media-query approach and its browser-compatibility reference, then determine the project scope and acceptance criteria. Done would require an agreed implementation and validation path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100