为什么我不能在css类级别上更改html按钮的宽度?
我想要三个按钮,每个按钮占用分配空间的 33%。它们被分组在一个“数字”类中。
当我为按钮标签定义宽度时,这工作正常,但是当我为它们所属的类中的所有按钮执行此操作时,没有任何反应。
html:
<html>
<link rel="stylesheet" href="opmaak.css">
<body>
<section>
<button type="button" value=1> 1</button>
<button type="button" value=2> 2</button>
<button type="button" value=3> 3</button><br>
</section>
</body>
</html>
css 当我在按钮级别执行此操作时:
button {
width: 33%;
}
button {
width: 33%;
}
css 当我为该类的所有按钮尝试它时:
button.numbers {
width:33%;
}
谁能指出这是为什么?
<html>
<link rel="stylesheet" href="opmaak.css">
<body>
<section class="numbers">
<button type="button" value=1> 1</button>
<button type="button" value=2> 2</button>
<button type="button" value=3> 3</button><br>
</section>
</body>
</html>