1

I am making a game of chess, and have five buttons for if you resign, if you draw, and to reset the game. However, I want them to appear bigger, and the css I have is not doing that. I have tried using font-size: 3rem;, but that does not appear to work.

Here is my HTML:

div.buttons {
    display: flex;
    justify-content: center;
    font-size: 3rem;
}
<div class="buttons">
    <button>Resign for White</button>
    <button>Resign for Black</button>
    <button>Offer Draw</button>
    <button>Accept Draw</button>
    <button>RESET GAME</button>
</div>

1
  • the browser apply a default font-size to button Commented May 20, 2021 at 7:53

3 Answers 3

3

Because button has its own font-size (13px in my Chrome instead of inherit) and you are targeting only parent div.

div.buttons {
    display: flex;
    justify-content: center;
    font-size: 3rem;
}
div.buttons button {
    font-size: inherit;
}
<div class="buttons">
    <button>Resign for White</button>
    <button>Resign for Black</button>
    <button>Offer Draw</button>
    <button>Accept Draw</button>
    <button>RESET GAME</button>
</div>

or you can set font-size directly to button:

div.buttons {
    display: flex;
    justify-content: center;
}
div.buttons button {
    font-size: 3rem;
}
<div class="buttons">
    <button>Resign for White</button>
    <button>Resign for Black</button>
    <button>Offer Draw</button>
    <button>Accept Draw</button>
    <button>RESET GAME</button>
</div>

Sign up to request clarification or add additional context in comments.

Comments

2

Your CSS is wrong, you have to fix it like follow:

div button {
    display: flex;
    justify-content: center;
    font-size: 3rem;
}
<div>
    <button>Resign for White</button>
    <button>Resign for Black</button>
    <button>Offer Draw</button>
    <button>Accept Draw</button>
    <button>RESET GAME</button>
</div>

Comments

2

.buttons {
    display: flex;
    justify-content: center;
}

.buttons  button {
    font-size: 3rem;
}
<div class="buttons">
    <button>Resign for White</button>
    <button>Resign for Black</button>
    <button>Offer Draw</button>
    <button>Accept Draw</button>
    <button>RESET GAME</button>
</div>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.