作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试添加这个 bootsnipp:https://bootsnipp.com/user/snippets/kl7nQ到我的元素,但它不起作用。
我的 html 页面:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-1.11.1.min.js" integrity="sha256-VAvG3sHdS5LqTT+5A/aeq/bZGa/Uj04xKxY8KM/w9EE=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="new 1.css">
</head>
<body>
<div class="container">
<div class="well well-sm text-center">
<h3>Radio</h3>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-success active">
<input type="radio" name="options" id="option2" autocomplete="off" chacked>
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option1" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
</div>
</div>
</div>
</body>
</html>
我的 CSS 页面:
.btn span.glyphicon {
opacity: 0;
}
.btn.active span.glyphicon {
opacity: 1;
}
你能帮帮我吗
最佳答案
您的代码看起来不错,您只是错过了包含 bootstrap.min.js
文件以使单选按钮起作用。我已将您的代码更新为可用的代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Snippet - Touch Friendly Bootstrap Radio buttons and Checkboxes</title>
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css'>
<link rel="stylesheet" href="css/style.css">
</head>
<style>
.btn span.glyphicon {
opacity: 0;
}
.btn.active span.glyphicon {
opacity: 1;
}
</style>
<body>
<div class="container">
<div class="well well-sm text-center">
<h3>Radio</h3>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-success">
<input type="radio" name="options" id="option2" autocomplete="off" checked>
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option1" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
</body>
</html>
关于html - Bootsnipp 单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45895811/
我正在尝试添加这个 bootsnipp:https://bootsnipp.com/user/snippets/kl7nQ到我的元素,但它不起作用。 我的 html 页面:
我正在尝试学习 Bootstrap/尝试使用 Bootsnipp。 我已经从链接中复制了 HTML、CSS 和 JS(尽管我认为我在这里有冗余):http://bootsnipp.com/snippe
我正在尝试在我的页面中使用 Bootsnipp 片段。即 collapsible-tree-menu-with-accordion .然而,整个事情正在以“平面”方式呈现。折叠/展开机制工作正常,但列
总的来说,我对 Django 和 Web 编程还很陌生。我想建立一个小型网站示例。我使用 django allauth 和 twitter bootstrap。但是,我想构建一个弹出登录、注册窗口,我
我是一名优秀的程序员,十分优秀!