【发布时间】:2018-08-06 21:52:51
【问题描述】:
您好 :) 我很难在垂直输入范围滑块的左侧定位最小值和最大值的标签。我希望 .label_max 位于滑块的顶部,而 .label_min 位于滑块的底部。
HTML:
<ion-content class="dark-container" padding>
<ion-grid>
<ion-row class="wizard_meter_content_block">
<ion-col>
<strong>How are you feeling about reaching your overall goal?</strong>
<br>
Use this meter to indicate how you feel
</ion-col>
</ion-row>
<ion-row class="wizard_meter_content_block">
<ion-col>
<label class="label_max">100 -</label>
<label class="label_min">0 -</label>
<input type="range" min="0" max="100" />
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
CSS:
page-wizard-meter {
font-weight: lighter;
ion-grid {
height: 100%;
display: flex;
}
.wizard_meter_content_block:nth-of-type(1) {
height: 30%;
align-items: center;
text-align: center;
}
.wizard_meter_content_block:nth-of-type(2) {
height: 70%;
justify-content: center;
align-items: center;
}
input[type=range] {
-webkit-appearance: none;
width: 100%;
transform: rotate(-90deg);
background: #0d6192;
border: none;
}
input[type=range]::-webkit-slider-runnable-track {
background: linear-gradient(to right, red, orange, yellow, green);
border-radius: 20px;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
background: white;
width: 20px;
height: 20px;
border-radius: 20px;
}
.label_max {
text-align: center;
left: -40px;
}
.label_min {
text-align: center;
left: -40px;
}
}
由于“text-align:center”,现在标签位于中心位置,并且它们已通过“left:-40px”调整到左侧,但我无法找出最佳定位方式.label_max 位于滑块的顶部,而 .label_min 位于底部,以便用户参考。
这是它现在的截图:
非常感谢您的帮助。非常感谢!
【问题讨论】:
标签: html css input ionic3 range