css 每天一練之一個(gè)標(biāo)簽實(shí)現(xiàn)box左邊豎線

效果圖

htm結(jié)構(gòu)

<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;
}

歡迎訪問我的博客,同步發(fā)布
感謝閱讀,如有錯(cuò)誤歡迎指正。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容