- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想实现一个 Bootstrap 按钮工具栏,如 getbootstrap.com 所示。具有附加行为:使用移动设备时,所有按钮组都应自动切换到垂直模式。
我认为最合适的解决方案如下:
.myClass {
@media (max-width: 760px) {
&:extend(.btn-group-vertical all);
}
@media (min-width: 761px) {
&:extend(.btn-group all);
}
}
最佳答案
您可以制作自己的垂直按钮组。添加自定义类.btn-vertical
(或任何您想命名的名称)到 .btn-group
.
从技术上讲,您只需要下面的 CSS,但是当按钮组更改为垂直方向时,您将留下第一个按钮的左边框和最后一个按钮的右边框是圆形的,这在视觉上没有吸引力。有关完整的 CSS,请参阅 jsfiddle。
body {
text-align: center;
padding-top: 50px;
background-color: grey;
}
@media (max-width: 768px) {
.btn-vertical {
position: relative;
display: inline-block;
vertical-align: middle;
}
.btn-vertical > .btn,
.btn-group > .btn {
position: relative;
float: left;
}
.btn-vertical > .btn,
.btn-vertical > .btn-group,
.btn-vertical > .btn-group > .btn {
display: block;
float: none;
width: 100%;
max-width: 100%;
}
.btn-vertical > .btn-group > .btn {
float: none;
}
.btn-vertical>.btn+.btn,
.btn-vertical>.btn+.btn-group,
.btn-vertical>.btn-group+.btn,
.btn-vertical>.btn-group+.btn-group {
margin-top: -1px;
margin-left: 0;
}
.btn-vertical>.btn:not(:first-child):not(:last-child) {
border-radius: 0;
}
.btn-vertical>.btn:first-child:not(:last-child) {
border-top-right-radius: 0;
border-top-left-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-vertical>.btn:last-child:not(:first-child) {
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.btn-vertical>.btn-group:not(:first-child):not(:last-child)>.btn {
border-radius: 0;
}
.btn-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,
.btn-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
body {
background-color: lightblue;
}
}
.btn-group.btn-group-lg .btn {
border-radius: 0;
border: none;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="media-change">
<div class="container">
<div class="btn-group btn-group-lg btn-vertical">
<button type="button" class="btn btn-primary">Sample</button>
<button type="button" class="btn">Sample</button>
<button type="button" class="btn btn-danger">Sample</button>
<button type="button" class="btn btn-warning">Sample</button>
<button type="button" class="btn btn-success">Sample</button>
<button type="button" class="btn btn-default">Sample</button>
</div>
</div>
</div>
关于twitter-bootstrap - 使用移动设备时从 .btn-group 切换到 .btn-group-vertical,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31893581/
我将 bxSlider 用于轮播。它提供水平和垂直模式,这很好。 唯一的问题是在垂直显示时,箭头仍然保持在水平位置。 HTML 代码: JS $('.sliderLo
我有一个包含数百个 STL 网格的文件夹,我想使用 flatten 命令将它们合并到 meshlab 中。 我使用的是常规 GUI,当我打开文件并选择所有这些 STL 文件时,如果我想“统一重复顶点”
我有 2 个表,其中包含一组数据,如下所示,我想获得结果,该结果将在字段 balance 中进行计算: 我卡在了 balance 字段,如何让 balance 运行? tblIn in_date
我想打印所有顶点及其相邻顶点。我在网上找到了一些关于如何做到这一点的例子,但它对我不起作用。我收到错误,++ 运算符不能用于 ai。另外我认为它需要是 vertex_idMap[*ai] 而不是 ve
运行 ./gradlew lint 向我报告一个令人困惑的错误: 39: Must be one of: RecyclerView.HORIZONTAL, RecyclerView.VERTICAL
你好,我无法弄清楚为什么传递 GLfloat 位置数组 (xyz) 的第一个元素突然为缓冲区提供该数组的所有元素。 glBufferData(GL_ARRAY_BUFFER, sizeof(Verte
抱歉打死马,但我无法理解为什么下面的方法不起作用。 设置line-height: 50px 设置vertical-align: top 据我了解,这应该使行框高 50 像素,然后 vertical-a
所以,我正在查看 Bootstrap 文档以寻找解决这个问题的方法,但没有找到任何东西。有没有办法,使用bootstrap组件,一个接一个垂直显示按钮组? 这是我目前所拥有的: but
目标:我需要通过移动现有顶点而不是添加新顶点来编辑矢量图层,因为我有一个表格,其中显示每个顶点的坐标。当我移动一个顶点时,我必须更新表格。 调查:我查看了 openlayers 4.6.5 的文档 I
这两个属性是一样的还是有不同的用法?vertical-align:top 和 vertical-align:text-top 最佳答案 区别可以通过line-height属性来解释。 MDN Sour
我有一些关于视觉内容的问题,可以在附件(在 Firefox 中使用 CTRL-+ 查看放大的视觉内容在左侧生成它的代码)。让我们命名视觉从上到下用数字 1、2、3、4、5 和 6 列出的内容。我对这种
XCode 建议我在创建的动态大小单元格中为约束设置垂直压缩和拥抱优先级。虽然单元格总是正确显示,但错误仍然存在,所以这不是问题,但我需要删除错误才能将更新提交到 App Store。 我在多标签
显示部分幻灯片的垂直 Flexslider。幻灯片从上到下剪切。这是不同图像尺寸的问题。 这是代码: $(window).load(function(){ $('.flexslider').f
我正在尝试 CSS multi-columns spec 并想出了 column-axis。但我不明白它的作用是什么?看起来 column-axis: horizontal; 是 regular
在思考这个问题时,我一直在挠头。我有 3 个 div。顶部和底部的 div 有一个最小高度,中间的 div 有未知的高度(按内容扩展)但应该在页面中居中。顶部和底部的 div 应填充剩余的顶部和底部空
我有一个包含文本的 div,line-height 大于文本的高度。这意味着每行文本的顶部和下方都有空间。 右侧有一个垂直边框,我希望其顶部与文本顶部对齐。我需要以某种方式将文本与其行的顶部对齐。 这
嗯,我得到了这个结构: #parent{ max-width: 800px; height: auto; margin: auto;
我这里有两个可能很简单的 CSS 问题: http://web288.merkur.ibone.ch/klingler/ 如何让页脚中的 © Klingler Fahrzeugtechnik AG 2
假设我们有一组 JSON 格式的人。每个实体大约有 100 个属性。使用 ng-repeat 的标准方法: ... Attribute1 Attribute2 ... Attribu
我正在尝试用点语言绘制一个稀疏矩阵,实际上节点连接是可以的,但问题是这些节点的垂直对齐,我尝试使用 pos 并放置具有 x 和 y 值的节点,但只是没有t 工作(我认为是因为默认布局)。如果你能帮助我
我是一名优秀的程序员,十分优秀!