I am trying to make accessible menu with button components, but for some reason when I reuse the same css it does not extend. I tried the "min-width" solution but then if I have any margin it goes out of the box (like in third example)
So example1 and example2 uses the same class but gets different result.
Why the button acts differently than div even though it has the same display method?
(Difference between 100% margin question: I am asking specifically for button "hidden" parameters that affects shrinking compared to div)
.test {
background: orange;
width: 300px;
}
.test2 {
all: unset;
margin-left: 8px;
display: flex;
justify-content: space-between;
}
.test2-with-minwidth {
min-width: 100%;
}
<div class="test">
<div class="test2">
<div class="left">hello2</div>
<div class="right">world</div>
</div>
<button class="test2">
<div class="left">hello2</div>
<div class="right">world</div>
</button>
<button class="test2 test2-with-minwidth">
<div class="left">hello2</div>
<div class="right">world</div>
</button>
</div>