Skip to content

Instantly share code, notes, and snippets.

@Victa
Created January 2, 2012 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Victa/1552181 to your computer and use it in GitHub Desktop.
Save Victa/1552181 to your computer and use it in GitHub Desktop.
Foundation CSS framework: fix webkit percent bug
/* Fix webkit percent bug */
@media screen and (-webkit-min-device-pixel-ratio:0) and (min-width: 767px){
.row>[class$="columns"]:last-of-type{
display: table-cell;
float: none;width: auto;
margin:0;
}
.row>[class$="columns"]:nth-last-of-type(2){
margin-right:4.4%;
}
.row>[class$="columns"]:last-of-type::after {
content: " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ";
visibility: hidden;
clear: both;
height: 0 !important;
display: block;
line-height: 0;
}
}
@Victa
Copy link
Author

Victa commented Jan 2, 2012

Alt text

TO

Alt text

@smileyj68
Copy link

That is fascinating - thanks for posting this. This is essentially forcing the last column to expand out like a table cell and consume the remaining space, eliminating the gap. I see what you mean about the offsets, this complicates things a bit. I'll poke around at this tomorrow, but if you have any notions for resolving that piece I'd love to hear it. I committed this as is to a branch of Foundation called 'webkit-grid', feel free to check out and make pull requests against that.

@Victa
Copy link
Author

Victa commented Jan 3, 2012

Glad to see that'll help you.
In foundation, you have chosen to make a margin on the left. Unfortunately, there would not have had this problem with offsets if you choose a right margin. :-)
But, I don't believe that you will change your grid system just for this crazy bug!

And no problems, If I have an idea, I'll make a pull request this time.
FYI, I found this tricks idea in OOCSS grid http://oocss.org/grids_docs.html

@smileyj68
Copy link

Looking forward to the request. We chose left margin because then we could make it work with first-child which has much greater support than last-child or last-of-type.

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