有人可以幫助我使用css語法來獲得具有數據屬性的html節點的多個css規則。一個html節點的多個css規則
下面是一些代碼,做工作:
<html>
<head>
</head>
<div class='Css_Rule_red Css_Rule_size'>
Test text
</div>
<style>.Css_Rule_red {
color: red;
}
.Css_Rule_size {
font-size: 500px;
}
</style>
</html>
這裏是我當前的代碼:
<html>
<head>
</head>
<div data-custom-css='Css_Rule_red Css_Rule_size'>
Test text
</div>
<style>[data-custom-css='Css_Rule_red'] {
color: red;
}
[data-custom-css='Css_Rule_size'] {
font-size: 500px;
}
</style>
</html>
無論是'Css_Rule_red'
和'Css_Rule_size'
工作獨立,但是,上面的代碼並不顯示任何的當組合在一起時,'Css_Rule_red'
或'Css_Rule_size'
css規則。
如何在使用數據屬性時擁有多個css規則?