Why can't I change the width of html buttons on class level in css? [duplicate]

5

I want three buttons to each take up 33% of the assigned space. They are grouped in a class "numbers".

When I define the width for the button tags, that works fine, but when I do it for all buttons in the class that they belong to, nothing happens.

html:

<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>

css when I do it on button level:

button {
    width: 33%;
}

css when I try it for all buttons of that class:

button.numbers {
    width:33%;
}

Could anyone point out why that is?

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>
Share
Improve this question
1
  • .numbers button {...}, also it would be good to put your <link... tag into a <head> section – biesior Apr 3 at 10:13

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

flutter websocket connection issue