This project is created to demonstrate a bug in Tailwind CSS, specifically when using the mx-auto
utility in combination with fractional scaling on Windows 11 operating systems and the xl
viewport.
You can track the bug here.
The issue arises when the system scaling is set to a value above 100% (e.g., 125%, 150%) on Windows 11 (might also happen on MacOS and Linux). When using Tailwind CSS with the xl
viewport and applying the mx-auto
utility, the horizontal margin is presumably incorrectly calculated, causing the element to appear too close to the screen borders.
This bug does not occur when scaling the browser or when the system scaling is set to 100%.
mx-auto
utility with the xl
viewport.The element with the mx-auto
utility should have consistent horizontal margins regardless of the system scaling settings. It should be equally distant from the screen borders, as shown in the expected result.
When system scaling is set to above 100%, the horizontal margin becomes much smaller than expected, causing the element to be too close to the screen borders.
The bug does not occur on viewports other than xl
.
You can view a live demo of the bug on the following link:
Live Demo
autoprefixer
: ^10.4.20postcss
: ^8.4.49tailwindcss
: ^3.4.15This project is purely for showcasing the bug. It is not an official bug fix however it does contain a workaround using JavaScript functions.
Feel free to fork this project and test it on different systems to help identify the cause and potential solutions for this bug.