我已經創建了多個自定義複選框,其中第一個元素也是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