Skip to content
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

[mediaqueries-4] min-width / max-width / min-height / max-height and fractional viewport dimensions #984

Closed
patrickhlauke opened this issue Jan 25, 2017 · 3 comments
Labels

Comments

@patrickhlauke
Copy link
Member

Currently, min- and max- prefixes are equivalent to >= and <= (see https://drafts.csswg.org/mediaqueries-4/#mq-min-max)

This is fine under the assumption that the width/height of the viewport will always be integers, but will fall apart in the case of fractional dimensions (admittedly an edge case?) - see for instance twbs/bootstrap#21552

Wondering if it would be possible to change these so that one of them is "including", while the other is "excluding". For instance, changing the definition to make min- equivalent to >= but max- equivalent to < only?

@patrickhlauke
Copy link
Member Author

patrickhlauke commented Jan 25, 2017

alternatively, for backwards-compatibility with existing content, perhaps having a new modifier for the value part to indicate it's "excluding", thus allowing authors to choose which one they want to make "excluding" (assuming browsers would then infer the rest from context, i.e. if it's used for a min- then the value with modifier results in a > only, and in case of max- with modifier value a < only).

Spitballing, based on mathematical notation for intervals, maybe the ] and [ characters (where [ could be assumed as the default for backwards compat)? Allowing for notation such as min-width: ]320px / max-width: [320px perhaps?

@frivoal frivoal added the mediaqueries-4 Current Work label Jan 25, 2017
@Marat-Tanalin
Copy link

Marat-Tanalin commented Feb 7, 2017

The @media (width < 600px) syntax stability is confirmed by Tab Atkins in a discussion started recently at [email protected].

I’ve filed a feature request for Firefox.

@patrickhlauke
Copy link
Member Author

As https://drafts.csswg.org/mediaqueries/#mq-range-context would cover the problem of fractional viewport dimensions, is it worth adding a note (or series of notes) in the spec to point out that:

  • min-/max- queries for width/height can cause problems (or gaps) with fractional viewport dimensions, and that this problem is better solved with the explicit use of >/<= etc?
  • in the range context section, have a matching note reiterating this

If yes, happy to have a stab at this, just let me know @frivoal @tabatkins

patrickhlauke added a commit to patrickhlauke/csswg-drafts that referenced this issue Mar 7, 2017
Closes w3c#984
Additionally, wraps `<div class="note">` around the note in range
context prose.
patrickhlauke added a commit to patrickhlauke/csswg-drafts that referenced this issue Mar 7, 2017
Closes w3c#984
Additionally, wraps `<div class="note">` around the note in range
context prose.
patrickhlauke added a commit to patrickhlauke/csswg-drafts that referenced this issue Mar 7, 2017
@frivoal frivoal added Needs Testcase (WPT) Testing Unnecessary Memory aid - issue doesn't require tests and removed Needs Testcase (WPT) labels Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants