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

Nested columns sometimes break due to rounding errors #742

Closed
paulcpederson opened this issue Dec 16, 2016 · 4 comments
Closed

Nested columns sometimes break due to rounding errors #742

paulcpederson opened this issue Dec 16, 2016 · 4 comments
Assignees

Comments

@paulcpederson
Copy link
Member

screen shot 2016-12-16 at 3 42 55 pm

The two column-5 elements should fit into the column-10. But the column-5 is rounding to 302.08333px. So 302.08333 + 302.08333 = 604.16666 and then column-10 is only 604.16667px. I think the browser is rounding these partial pixel values sometimes correctly, sometimes incorrectly.

Could fix this by rounding all values to even pixels, maybe?

@paulcpederson
Copy link
Member Author

I think an approach that would solve this would be to create a 1 column unit and use that for all column calculations. So:

$col-unit: $container-width / $column-count;

.column-12 {
  max-width: 12 * $col-unit;
}

@paulcpederson paulcpederson added this to the v1.0.0-rc.2 milestone Dec 20, 2016
@DominicGauthier
Copy link

DominicGauthier commented Jan 4, 2017

I try your solution in my project and it'seem working find, but I work in less and I can use round function with decimal (http://lesscss.org/functions/#math-functions-round) for the value of col-unit. I can't find the same method in sass, but I found this : https://gist.github.com/terkel/4373420

.column-unit(@nbcolumn){@column-unit: round(@container-width / @nbcolumn,2);}

@paulcpederson paulcpederson modified the milestones: v1.0.0-rc.2, v1, v1.0.0-rc.3 Mar 1, 2017
@paulcpederson paulcpederson modified the milestones: v1.0.0-rc.3, v1.0.0-rc.4 Apr 4, 2017
@paulcpederson paulcpederson removed this from the v1.0.0-rc.4 milestone Jun 9, 2017
@HeathMeyette
Copy link

Assigning to Tim. @tim-white-esri please feel free to reassign to your team members that have additional bandwidth.

@paulcpederson paulcpederson self-assigned this Mar 24, 2018
paulcpederson added a commit to paulcpederson/calcite-web that referenced this issue Mar 24, 2018
macandcheese added a commit that referenced this issue Mar 24, 2018
#742 - fix rounding error by making column max more even
@paulcpederson
Copy link
Member Author

will be fixed in the next relase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants