css 每天一练之一个标签实现box左边竖线

效果图

htm结构

<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<div class="box4"></div>
<div class="box5"></div>
<div class="box6"></div>

css样式

div{ 
    width: 200px;
    height: 50px;
    background-color: #15b9d4; 
    margin: 20px auto;
    box-sizing: border-box;
}
.box1{
    border-left: 5px solid #000;
}
.box2{
    box-shadow: inset 5px 0 0 0 #000;
}
.box3{
    box-shadow: -5px 0 0 0 #000;
}
.box4{
    background-image: linear-gradient(90deg,#000000 5px, transparent 5px);
}
.box5{
    filter: drop-shadow(-5px 0 0 #000);
}
.box6{
    position: relative;
}
.box6:after{
    content: '';
    width: 5px;
    height: 50px;
    position: absolute;
    left: 0;
    top: 0;
    background-color: #000;
}

欢迎访问我的博客,同步发布
感谢阅读,如有错误欢迎指正。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容