问题
The following CSS works in Firefox, IE9, and the Gnome "Web" browser.
li.col:nth-child(3n+1):nth-last-child(2),
li.col:nth-child(3n+1):nth-last-child(2) + li {width: 47.5%;}
The first line should select the last row's first child and set it to 47.5%. Firefox and Chrome both do this. The second line should select the same element but then move forward one element to the last child in the grid. In Firefox, IE9, and Web it does this but in Google Chrome does not.
Interestingly if you "inspect element" in Google Chrome it causes the second to last list element to revert back to its default width (30% as set by the .col class).
Here's a CodePen I set up for you to easily test: http://codepen.io/anon/pen/dzbci
Any help would be appreciated.
回答1:
Use
li.col:nth-child(3n+1):nth-last-of-type(2) + li {width: 47.5%;}
http://codepen.io/anon/pen/daqej
来源:https://stackoverflow.com/questions/20436485/google-chrome-and-nth-last-child