我正在为位于内容 div 上的倾斜选项卡开发高级样式。
我刚刚解决了它,遵循创建建议以遵循 :before 和 :after 来塑造 div。但是,我一直试图让 div 本身使用最大宽度而不是宽度:
HTML
<br>
<div class="tab">Really really really really really really long content title</div>
<div class="tab-content">Content text</div>
CSS
.
tab-content, .tab, .tab:before, .tab:after {
background-color: #f5f5f5;
}
body {
background-color: #666;
}
.tab-content {
border-left: 1px solid blue;
border-right: 1px solid blue;
border-bottom: 1px solid blue;
border-top: 1px solid blue;
margin-top: -1px;
padding-top:10px;
padding-bottom:20px;
padding-left:10px;
padding-right:10px;
}
.tab:before {
}
.tab {
max-width: 150px;
display:block;
border-left: 1px solid blue;
border-top: 1px solid blue;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
height: 50px;
border-radius: 15px 100px 0px 0px;
position: relative;
z-index: 100000000;
line-height:50px;
padding-left:20px;
}
.tab:after {
border-right: 1px solid blue;
border-top: 1px solid blue;
border-top-left-radius: 0px;
border-top-right-radius: 10px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 00px;
display: block;
content:" ";
width: 150px;
height: 50px;
top: -1px;
position: absolute;
right: -28px;
transform:skewX(45deg);
-ms-transform:skewX(45deg);
-webkit-transform:skewX(45deg);
z-index: -1;
}
有任何想法吗?
jsFiddle在这里:http: //jsfiddle.net/robmc/ZvEyx/9/