在哪里可以找到HTML5 Range输入的Bootstrap样式?

我正在使用[使用Bootstrap]设计一个表单,并使用HTML5的新type =“range”来指定一个美元金额。

< input type =“range”min =“10”max =“1000”step =“10”/>

任何人都可以推荐使用< input>风格与Bootstrap的表单元素?特别是HTML5 Range输入[以及相应的输出元素]。

我很惊讶,bootstrap还没有提供HTML5格式的资产,并且想避免重新创造轮子;除非绝对必要

如果有人能指出正确的方向,我会很感激。

解决方法

对于输入类型范围,bootstrap中没有特定的类,但是您可以使用CSS和简单的java脚本来定制它,很酷这里就是一个例子!

见演示:jsfiddle – Input type range styling

body {
  background: #2B353E;
  margin: 0;
  padding: 0;
}
#slider {
  width: 400px;
  height: 17px;
  position: relative;
  margin: 100px auto;
  background: #10171D;
  -webkit-border-radius: 40px;
  -moz-border-radius: 40px;
  border-radius: 40px;
  -webkit-box-shadow: inset 0px 0px 1px 1px rgba(0,0.9),0px 1px 1px 0px rgba(255,255,0.13);
  -moz-box-shadow: inset 0px 0px 1px 1px rgba(0,0.13);
  box-shadow: inset 0px 0px 1px 1px rgba(0,0.13);
}
#slider .bar {
  width: 388px;
  height: 5px;
  background: #333;
  position: relative;
  top: -4px;
  left: 4px;
  background: #1d2e38;
  background: -moz-linear-gradient(left,#1d2e38 0%,#2b4254 50%,#2b4254 100%);
  background: -webkit-gradient(linear,left top,right top,color-stop(0%,#1d2e38),color-stop(50%,#2b4254),color-stop(100%,#2b4254));
  background: -webkit-linear-gradient(left,#2b4254 100%);
  background: -o-linear-gradient(left,#2b4254 100%);
  background: -ms-linear-gradient(left,#2b4254 100%);
  background: linear-gradient(left,#2b4254 100%);
  filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#1d2e38',endColorstr='#2b4254',GradientType=1);
  -webkit-border-radius: 40px;
  -moz-border-radius: 40px;
  border-radius: 40px;
}
#slider .highlight {
  height: 2px;
  position: absolute;
  width: 388px;
  top: 6px;
  left: 6px;
  -webkit-border-radius: 40px;
  -moz-border-radius: 40px;
  border-radius: 40px;
  background: rgba(255,0.25);
}
input[type="range"] {
  -webkit-appearance: none;
  background-color: black;
  height: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  position: relative;
  top: 0px;
  z-index: 1;
  width: 11px;
  height: 11px;
  cursor: pointer;
  -webkit-box-shadow: 0px 6px 5px 0px rgba(0,0.6);
  -moz-box-shadow: 0px 6px 5px 0px rgba(0,0.6);
  box-shadow: 0px 6px 5px 0px rgba(0,0.6);
  -webkit-border-radius: 40px;
  -moz-border-radius: 40px;
  border-radius: 40px;
  background-image: -webkit-gradient(linear,left bottom,#ebf1f6),#abd3ee),color-stop(51%,#89c3eb),#d5ebfb));
}
input[type="range"]:hover ~ #rangevalue,input[type="range"]:active ~ #rangevalue {
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
  filter: alpha(opacity=100);
  opacity: 1;
  top: -75px;
}
/* Tool Tip */

#rangevalue {
  color: white;
  font-size: 10px;
  text-align: center;
  font-family: Arial,sans-serif;
  display: block;
  color: #fff;
  margin: 20px 0;
  position: relative;
  left: 44.5%;
  padding: 6px 12px;
  border: 1px solid black;
  -webkit-box-shadow: inset 0px 1px 1px 0px rgba(255,0.2),0px 2px 4px 0px rgba(0,0.4);
  -moz-box-shadow: inset 0px 1px 1px 0px rgba(255,0.4);
  box-shadow: inset 0px 1px 1px 0px rgba(255,0.4);
  background: -webkit-gradient(linear,#222931),#181D21));
  -webkit-border-radius: 20px;
  -moz-border-radius: 20px;
  border-radius: 20px;
  width: 18px;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: alpha(opacity=0);
  opacity: 0;
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
  -ms-transition: all 0.5s ease;
  transition: all 0.5s ease;
  top: -95px;
}
input[type="range"]:focus {
  outline: none;
}
<div id="slider">
  <input class="bar" type="range" id="rangeinput" value="50" onchange="rangevalue.value=value" />
  <span class="highlight"></span>
  <output id="rangevalue">50</output>
</div>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


HTML5和CSS3实现3D展示商品信息的代码
利用HTML5中的Canvas绘制笑脸的代码
Html5剪切板功能的实现
如何通过HTML5触摸事件实现移动端简易进度条
Html5移动端获奖无缝滚动动画实现
关于HTML5和CSS3实现机器猫的代码
HTML5使用DOM进行自定义控制
使用HTML5 Canvas绘制阴影效果的方法
使用PHP和HTML5 FormData实现无刷新文件上传
如何解决HTML5 虚拟键盘出现挡住输入框的问题
HTML5中div和section以及article的区别分析
html5和CSS 实现禁止IOS长按复制粘贴功能
html5 touch事件实现触屏页面上下滑动
canvas 模拟实现电子彩票刮刮乐的代码
HTML5 Plus 实现手机APP拍照或相册选择图片上传的功能
Android自定义环形LoadingView效果
HTML5 canvas绘制五角星的方法
html5使用html2canvas实现浏览器截图
使用Canvas处理图片的方法介绍
利用Canvas模仿百度贴吧客户端loading小球的方法