[英]overding some properties of css class for a div
我有一個div,我向其應用css類。現在在css類中,heigh被標為x px,但我希望我的div為y px。如何在不更改CSS的情況下覆蓋CSS的高參數。
使用內聯css與!important標簽
<div class="yourclass" style="height:ypx!important">
您需要更改CSS才能覆蓋它-使用級聯為其賦予新值,或添加優先於外部樣式聲明的內聯style
屬性(請注意!important
)。
CSS聲明級聯 。 這意味着您可以將其他規則附加到其他CSS類,並將兩者都分配給一個元素:
<style type="text/css">
.style1 {
color: red;
height: 100px;
}
.style1.style2 {
height: 200px;
}
</style>
<!-- This DIV will have a height of 200px and red foreground color -->
<div class="style1 style2"></div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.