有一个选项可以通过Javascript来完成。另一种选择是通过 CSS 提供高度height: 60px;
但是如果文本更多呢?
.slider {
width: 323px;
}
.yo-btn {
display: inline-block;
padding-top: 2px;
padding-bottom: 2px;
padding-left: 0;
padding-right: 0;
margin-bottom: 0;
border: 1px solid transparent;
font-size: 14px;
font-weight: 400;
line-height: 1.42857143;
text-align: center;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border-radius: 0;
background: #fff;
border-color: #e0e0e0;
}
Run Code Online (Sandbox Code Playgroud)
<div class="slider">
<button type="button" class="yo-btn yo-btn-range" value="1" style="width: 25%;">Small</button>
<button type="button" class="yo-btn yo-btn-range" value="3" style="width: 25%;">Slightly Large</button>
<button …
Run Code Online (Sandbox Code Playgroud)