我想用CSS3做一个像iPhone后退按钮的按钮.
可能吗?怎么样?
你可以看到我的目标here:
解决方法
这是一个可能的解决方案,主要使用CSS2(只需一点可选的CSS3用于边框半径和框阴影).这是一个有限的,直接的解决方案,似乎在Chrome和Firefox的当前版本(截至2012年11月)中起作用,同样在IE7-9中几乎相同.我没有IE10测试,但可以合理地假设它是罚款.
我写了“限制”,因为这些按钮必须使用固体背景颜色,以便跨浏览器进行渲染.此外,盒子阴影并没有完全延伸到“点”,而是谨慎使用它可能不会令人反感. Box-shadow是可选的,因为它不支持旧的IE,除非增加了像CSS3Pie这样的东西.
.wiz-buttons > a { position: relative; display: block; font: normal 14px Arial; text-decoration: none; cursor: pointer; } .wiz-buttons > a > .button { min-width: 75px; } /* Next Button */ .wiz-buttons > .next { color: #FFF; } .wiz-buttons > .next > .arrow-inner { display: block; position: absolute; top: 1px; right: 3px; z-index: 2000; width: 0; height: 0; border: 14px solid transparent; border-left-color: #E38A13; } .wiz-buttons > .next > .arrow { display: block; float: right; width: 0; height: 0; border: 15px solid transparent; border-left-color: #CC790B; } .wiz-buttons > .next > .button { display: block; float: right; line-height: 20px; background-color: #E38A13; border: 2px solid #CC790B; border-right: 0; padding: 3px 3px 3px 9px; text-align: center; -webkit-border-radius: 2px 0 0 2px; -moz-border-radius: 2px 0 0 2px; border-radius: 2px 0 0 2px; filter: progid: DXImageTransform.Microsoft.gradient(enabled=false); -webkit-Box-shadow: inset 0 1px 0 rgba(255,255,0.2),0 1px 2px rgba(0,0.05); -moz-Box-shadow: inset 0 1px 0 rgba(255,0.05); Box-shadow: inset 0 1px 0 rgba(255,0.05); } .wiz-buttons > .next:hover > .arrow { border-left-color: #ad6608; } .wiz-buttons > .next:hover > .arrow-inner { border-left-color: #CC790B; } .wiz-buttons > .next:hover > .button { background-color: #CC790B; border-color: #b66c09; } /* PrevIoUs Button */ .wiz-buttons > .prevIoUs { color: #666; } .wiz-buttons > .prevIoUs > .arrow-inner { display: block; position: absolute; top: 1px; left: 3px; z-index: 2000; width: 0; height: 0; border: 14px solid transparent; border-right-color: #f4f4f4; } .wiz-buttons > .prevIoUs > .arrow { display: block; float: left; width: 0; height: 0; border: 15px solid transparent; border-right-color: #e8e8e8; } .wiz-buttons > .prevIoUs > .button { display: block; float: left; line-height: 20px; background-color: #f6f6f6; border: 2px solid #eaeaea; border-left: 0; padding: 3px 9px 3px 3px; text-align: center; -webkit-border-radius: 0 2px 2px 0; -moz-border-radius: 0 2px 2px 0; border-radius: 0 2px 2px 0; filter: progid: DXImageTransform.Microsoft.gradient(enabled=false); -webkit-Box-shadow: inset 0 1px 0 rgba(255,0.05); } .wiz-buttons > .prevIoUs:hover > .arrow { border-right-color: #e1e1e1; } .wiz-buttons > .prevIoUs:hover > .arrow-inner { border-right-color: #eaeaea; } .wiz-buttons > .prevIoUs:hover > .button { background-color: #eaeaea; border-color: #e3e3e3; }
<div class="wiz-buttons"> <a class="prevIoUs" href="#"> <span class="arrow"></span> <span class="arrow-inner"></span> <span class="button">PrevIoUs</span> </a> <a class="next" href="#"> <span class="arrow"></span> <span class="arrow-inner"></span> <span class="button">Next</span> </a> </div>
我希望有人觉得这很有用.