我正在try 用不同的字体对齐两个按钮.我不能使用绝对位置,因为按钮应该可以适应任何屏幕大小.所以大概是:高度--屏幕的10% 按钮1的宽度为80%,按钮2的宽度为屏幕的20%
.button1 {
font-family: -apple-system, system-ui, "Segoe UI";
height: 40vh;
width: 60%;
display: inline;
}
.button2 {
font-family: Arial;
height: 40vh;
width: 20%;
display: inline;
}
<button class="button1">Button 1</button>
<button class="button2">2</button>
<br><br> As you can see button 1 is aligned slightly above button 2. This only happens when the font is not the same. Below is an example where they align correctly.
<br><br>
<button class="button1">Button 1</button>
<button class="button1" style="width:30%">2</button>