栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使单选按钮看起来像按钮

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使单选按钮看起来像按钮

可以使用CSS来完成,而无需大型框架。我已经使用复选框和单选按钮完成了此操作。

此方法无需添加新的HTML或引入任何JS库即可。 =>

HTML的新命令

这是一个十分钟的hacky版本,您可以进一步清理它,但是它展示了一个简单的好例子。

.donate-now {  list-style-type: none;  margin: 25px 0 0 0;  padding: 0;}.donate-now li {  float: left;  margin: 0 5px 0 0;  width: 100px;  height: 40px;  position: relative;}.donate-now label,.donate-now input {  display: block;  position: absolute;  top: 0;  left: 0;  right: 0;  bottom: 0;}.donate-now input[type="radio"] {  opacity: 0.01;  z-index: 100;}.donate-now input[type="radio"]:checked+label,.Checked+label {  background: yellow;}.donate-now label {  padding: 5px;  border: 1px solid #CCC;  cursor: pointer;  z-index: 90;}.donate-now label:hover {  background: #DDD;}<ul >  <li>    <input type="radio" id="a25" name="amount" />    <label for="a25">$25</label>  </li>  <li>    <input type="radio" id="a50" name="amount" />    <label for="a50">$50</label>  </li>  <li>    <input type="radio" id="a75" name="amount" checked="checked" />    <label for="a75">$75</label>  </li>  <li>    <input type="radio" id="a100" name="amount" />    <label for="a100">$100</label>  </li>  <li>    <input type="radio" id="other" name="amount" />    <label for="other">other:</label>  </li>  <li>    <input type="text" id="otherAmount" name="numAmount" />  </li></ul>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/573233.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号