-
Notifications
You must be signed in to change notification settings - Fork 658
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
[Request] [css-pseudo] Selector :viewport #4581
Comments
See https://wiki.csswg.org/faq#selectors-that-depend-on-layout for why
can't be done. |
Please read https://wiki.csswg.org/faq#selectors-that-depend-on-layout, it explains why that doesn't work either. |
@Loirooriol |
No need problem abilities like Toggle States. The talking is only about |
|
And what is bad? In case of |
The provided link already explains Why Doesn't This Argument Apply To :hover? |
No, it doesn't. Why is infinity loop bad when it is visible? I don't talk about cases when it is not visible and don't know them. |
Please read the linked article. Selectors can't depend on layout (unless some constraints are apply like in container queries). Otherwise it would be circular, which is bad, for the reasons explained there. I don't know what you mean with visible or non-visible cases. |
I have read it several times. Browsers blink on infinity loop, then it is visible and will be fixed. Why is it bad? Idk about invisible loops but the article talks a little about this. |
|
And why is |
Just reading you description:
So you want to select elements depending on whether they have a non-zero intersection with the viewport, or something along these lines. This is a dependency on layout. It's not like |
Ok, I have a solution. |
Detecting loops at run-time is already covered in the article:
|
It is not hard for browsers now. They are very smart now. I think that this opinion is outdated. If they can detect js loops, they can do this for css loops too. |
And they should do this only for rules with such selectors, not for all. Not a big problem. |
Your question has been fully answered by Oriol. This precise idea has been rejected in the past, and gets suggested so often that we have an explicit FAQ entry for it. All of the reasoning in the FAQ still applies today. |
To select elements which are in viewport at the moment - user can see them (or its position if hidden) without scrolling.
The text was updated successfully, but these errors were encountered: