【发布时间】:2014-10-29 22:08:04
【问题描述】:
我正在使用来自http://www.csscheckbox.com/ 的样式化 css 单选按钮
问题是他们手动给单选按钮高度(即 30 像素)并且文本溢出到下一行。
所以我尝试删除手动高度。然后由于背景图像用作背景位置,因此存在更多问题:(
这里使用的背景图片如下img。
这是单选按钮的 css 脚本。
input[type=radio].css-checkbox {
display:none;
}
input[type=radio].css-checkbox + label.css-label {
padding-left:35px;
height:30px;
display:inline-block;
line-height:30px;
background-repeat:no-repeat;
background-position: 0 0;
font-size:20px;
vertical-align:middle;
cursor:pointer;
}
input[type=radio].css-checkbox:checked + label.css-label {
background-position: 0 -30px;
}
label.css-label {
background-image:url({{ URL::to('/') }}/application/assets/img/checkbox.png);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
这是标记。
<ul>
<li><input type="radio" name="answer2671" id="radio12344" class="css-checkbox" value="1" /><label for="radio12344" class="css-label radGroup1">Planning and strategy</label></li>
<li><input type="radio" name="answer2671" id="radio12345" class="css-checkbox" value="2" /><label for="radio12345" class="css-label radGroup1">Supporting your teammates</label></li>
<li><input type="radio" name="answer2671" id="radio12346" class="css-checkbox" value="3" /><label for="radio12346" class="css-label radGroup1">Motivating everyone</label></li>
<li><input type="radio" name="answer2671" id="radio12347" class="css-checkbox" value="4" /><label for="radio12347" class="css-label radGroup1">Courage in the face of adversity</label></li>
</ul>
感谢任何形式的帮助!
【问题讨论】:
-
包含你的标记会有很大帮助
-
@Fabio 我添加了标记。谢谢!
标签: html css background radio