好像我被困了.为什么下面的代码显示12px但不是50px的消息?不是class1有更高如果我不允许更改*属性如何修复它?甚至!重要没有帮助.
<html>
<head>
<style type="text/css">
*
{
font-size : 12px
}
.class1
{
font-size : 50px;
}
</style>
</head>
<body>
<div class="class1">
<span>why it is not 50px font size?</span>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Ric*_*ers 12
那是因为*还会选择<span>你内部的标签<div>.
所以*在这种情况下更具体,因此具有优先权.
.class1 span
{
font-size : 50px;
}
Run Code Online (Sandbox Code Playgroud)
以上可行.