オンボタン5px border-bottomのアクティブなクラスを追加しています。ボタンサイズが5ピクセル増加します。私はボタンのサイズを増やしたくない。そうする簡単な方法はありますか?ボックスサイズは機能しません。5 pxボーダーがボタンに追加され、ボタンのサイズが増加します。ボックスサイズが機能しない
*,
*:after,
*::before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.container {
width: 100%;
border: 2px solid blue;
}
.button {
background: black;
width: 150px;
border: 0;
padding: 20px;
margin: 0;
color: white;
}
.active {
border-bottom: 5px solid yellow;
}
<div class="container">
<button class="button active">button active</button>
<button class="button">button</button>
</div>
ボックスサイズはボタン/入力タグではサポートされていません – Mahmoud