-
Notifications
You must be signed in to change notification settings - Fork 19
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
Incorrect output when using both > and >= (or similar) #12
Comments
For
According to this article: http://tzi.fr/css/prevent-double-breakpoint and this answer on stackoverflow: http://stackoverflow.com/questions/13241531/what-are-the-rules-for-css-media-query-overlap/13611538#13611538 |
Unfortunately, they do. In at least two browsers, you can actually get caught between pixels. We were all doubters, but I created a few tests to prove this was happening, which we can look for around here or recreate if necessary and re-test. The easiest way to create a fast test:
Besides the iframe use-case which is valid in and of itself, this issue would also happen when a browser window is resized to an odd pixel. Test Edge, IE11, Chrome, Firefox, and Safari. I believe Edge and Firefox will show a red background color and dev tools will report 400.5px, while |
Sad, but confirmed I have double breakpoints here: So both .999 and .001 are unsafe from overlap, any workarounds? |
@yisibl Issue is still there. Please, reopen the issue. Input: @media (1024px > width >= 768px) {}
@media (768px <= width < 1024px) {}
@media (1024px >= width > 768px) {}
@media (768px < width <= 1024px) {}
@media (1024px >= width >= 768px) {}
@media (768px <= width <= 1024px) {} Output (v. 2.1.1): @media (min-width: 769px) and (max-width: 1024px) {} /* Incorrect */
@media (min-width: 768px) and (max-width: 1023px) {} /* Correct */
@media (min-width: 768px) and (max-width: 1023px) {} /* Incorrect */
@media (min-width: 769px) and (max-width: 1024px) {} /* Correct */
@media (min-width: 768px) and (max-width: 1024px) {} /* Correct */
@media (min-width: 768px) and (max-width: 1024px) {} /* Correct */ |
@hudochenkov OK, do you want to fix it? |
…rthand Fix incorrect output when using both > and >= (or similar) #12
According to my test, a /* Input: */
@media (width < 600px) {}
/* Output */
@media (max-width: 599.98px) {} I’m using the viewport widths of mobile devices as breakpoints to test if a browser has a problem with fractional pixel values (e.g. What can I do to get this change into the plugin? |
…rthand Fix incorrect output when using both > and >= (or similar) #12
There is an issue with reverse order of values, but logic order is the same:
Input:
Output:
Expected output:
postcss-media-minmax v.2.1.0
@jonathantneal probably you can help with this as it's related to your PR :)
The text was updated successfully, but these errors were encountered: