我已经创建了多个自定义复选框,其中第一个元素也是select
元素。我需要将所有元素放在同一行中,但为了减少每行之间的余量,我使用了line-height=something
属性,但这会导致select
元素的文本被扭曲\ cut,所以我降低了文本select
手动但我无法降低其复选框。Html CSS - 无法自定义选择标记以及自定义复选框
HTML:
<div id="checkBoxesContainer">
<input type='checkbox' value='valuable1' id="valuable1"/><label for="valuable1"><span></span></label>
<div>
<select>
<option value="0">Test content</option>
<option value="1">Content 1</option>
<option value="2">Content 2</option>
<option value="3">Content 3</option>
<option value="4">Content 4</option>
</select>
</div>
<input type='checkbox' value='valuable2' id="valuable2"/><label for="valuable2"><span></span></label><div>qwertyu</div>
<input type='checkbox' value='valuable3' id="valuable3"/><label for="valuable3"><span></span></label><div>asdfghj</div>
<input type='checkbox' value='valuable4' id="valuable4"/><label for="valuable4"><span></span></label><div>zxcvbnm</div>
<input type='checkbox' value='valuable5' id="valuable5"/><label for="valuable5"><span></span></label><div>qazwsxe</div>
</div>
CSS:
/* for the custom checkboxes!! */
input[type=checkbox] {
display:block;
visibility: hidden;
}
label span
{
background-color: grey;
height: 20px;
width: 20px;
display:inline-block;
cursor: pointer;
}
input[type=checkbox]:checked + label span
{
background-color: red;
height: 20x;
width: 20px;
display:inline-block;
cursor: pointer;
}
#checkBoxesContainer{
width: 500px;
display: block;
margin: 50px auto;
font-size: 18px;
line-height: 10px;
}
select {
position: relative;
-webkit-appearance: none;
-moz-appearance: none;
-op-appearance: none;
height: auto;
padding: 0 35px 0 0;
line-height: 25px;
border: none;
font-size: 18px;
bottom: -15px;
background: url("http://cdn1.iconfinder.com/data/icons/cc_mono_icon_set/blacks/16x16/br_down.png") no-repeat right center;
}
#checkBoxesContainer div{
position: relative;
width: 550px;
left: 65px;
bottom: 15px;
color: #cfcecf;
font-family: 'Open Sans', sans-serif;
line-height: 5px
}
编辑:这是select
文字是什么时行高度降低,如:
的http://的jsfiddle。 net/Lu03xfp4/1/ – Morpheus
你能解释一下你有什么需要改变的地方吗?这样的兴奋? – undroid
从select中删除不必要的样式,就是这样。没有改变任何东西。 – Morpheus