css3 unset属性
生活随笔
收集整理的這篇文章主要介紹了
css3 unset属性
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
unset
unset 關(guān)鍵字我們可以理解為不設(shè)置,其實,它是關(guān)鍵字initial和inherit的組合。
當(dāng)我們給一個css屬性設(shè)置了unset的話:
1,如果該屬性默認(rèn)繼承屬性,該值等同于inherit
2,如果該屬性是非繼承屬性,該值等同于initial
使用unset繼承/取消樣式:
<div class="father">
<div class="children">子級元素一</div>
<div class="children unset">子級元素二</div>
</div>
.father {
color: red;
border: 1px solid black;
}
.children {
color: green;
border: 1px solid blue;
}
.unset {
color: unset;
border: unset;
}
1,由于color是可繼承樣式,設(shè)置color:unset的元素,最終表現(xiàn)為父級的顏色red.
2,由于border是不可繼承樣式,設(shè)置了border:unset的元素,最終表現(xiàn)為border:initial,也就是默認(rèn)border樣式,無邊框。
a{
width:200px;
height:100px;
display:block;
color:darkgreen;
background-color: #1AA094;
}
a:focus{
background-color:rebeccapurple;
}
a.active:focus{
background-color:unset;
}
<a href="#" class="active">我真的很困!</a>
原文鏈接:
談?wù)勔恍┯腥さ腃SS題目(十五)-- 談?wù)?CSS 關(guān)鍵字 initial、inherit 和 unset
總結(jié)
以上是生活随笔為你收集整理的css3 unset属性的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SGE 节点处于E状态
- 下一篇: 【vue】组件使用Deferred特性