html+css如何实现一个空的div标签如何实现一半白一半黑
.test {
width: 100px;
height: 100px;
border: 1px solid #000;
}
.test:after {
content: "";
display: inline-block;
width: 50px;
height: 100%;
background-color: #000;
}
<style>
.box{
height:0;
width:0;
border-width:50px;
border-style:solid;
border-color:#000 #000 #ccc #ccc;
}
</style>
<body>
<div class="box"></div>
</body>
直接用了border,所以白色不明显,换了灰色。。。
.box{
width: 100px;
height: 100px;
border-left:50px solid #000;
border-right:50px solid #fff;
box-sizing: border-box;
}
5 回答1.4k 阅读
5 回答1.2k 阅读✓ 已解决
2 回答870 阅读✓ 已解决
4 回答968 阅读✓ 已解决
2 回答1.4k 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
2 回答841 阅读✓ 已解决