大佬教程收集整理的这篇文章主要介绍了CSS中的对角堆栈效果,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
.card { float: left; width: 100px; height: 140px; BACkground-color: #fff; border: 1px solid #000; border-radius: 5px; } .card:nth-child(2) { margin-left: -98px; margin-top: -2px; } .card:nth-child(3) { margin-left: -98px; margin-top: -4px; } .card:nth-child(4) { margin-left: -98px; margin-top: -6px; } /* and so on... */
示例:http://jsfiddle.net/coev55w6/
我知道我可以通过为每张卡指定不同的边距来做到这一点,但我想知道是否有更好的方法.
创建纯粹的水平偏移很容易:
.card { float: left; width: 100px; height: 140px; BACkground-color: #fff; border: 1px solid #000; border-radius: 5px; } .card:not(:first-child) { margin-left: -98px; }
纯粹的垂直也很容易.但有没有办法只用几条CSS规则来获得对角线偏移?
以上是大佬教程为你收集整理的CSS中的对角堆栈效果全部内容,希望文章能够帮你解决CSS中的对角堆栈效果所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。