I wish to style the <button>
element using CSS grid.
I know the user agent stylesheet has some defaults, but I can't find the right one to override.
It should look like this - indeed, it does look like this if I style a div
:
However styling a button looks like this:
Here's a demonstration using JSfiddle
Here's my CSS:
button, .button {
display: grid;
justify-content: left;
align-items: center;
grid-auto-flow: column;
grid-template-columns: 80px 1fr;
}
And HTML:
How buttons look:
<button>
<h1>
hello
</h1>
<h2>
world
</h2>
</button>
How divs look, and how I want buttons to look:
<div class="button">
<h1>
hello
</h1>
<h2>
world
</h2>
</div>
My styles work on a div
, but don't work on a button
.
How can I style a button using CSS grid?