【发布时间】:2021-02-03 11:45:35
【问题描述】:
我的网站上有一个选择下拉菜单,并希望使用 CSS 重新设置它的样式,因此选项是单个点而不是下拉菜单。这是可以使用纯CSS的东西吗?
任何帮助将不胜感激,谢谢。
CSS
.radio-toolbar input[type="radio"] {
display: none;
}
.radio-toolbar label {
display: inline-block;
background-color: #ddd;
padding: 4px 11px;
font-family: Arial;
font-size: 16px;
cursor: pointer;
}
.radio-toolbar input[type="radio"]:checked+label {
background-color: #bbb;
}
HTML/Liquid
<label class="product-tag pb-2 mt-4" for="SingleOptionSelector-{{ forloop.index0 }}">
{{ option.name }}
</label>
<select class="radio-toolbar single-option-selector single-option-selector-{{ section.id }} product-form__input" id="SingleOptionSelector-{{ forloop.index0 }}" data-index="option{{ forloop.index }}">
{% for value in option.values %}
<option value="{{ value | escape }}"{% if option.selected_value == value %} selected="selected"{% endif %}>{{ value }}</option>
{% endfor %}
</select>
Current
Aim
【问题讨论】:
-
这是一个 stackoverflow 问题:stackoverflow.com/questions/12646725/… 这是一个 jsfiddle:jsfiddle.net/6avqc/1
标签: javascript html css liquid