html - 如何在 RTL 页面中显示 Bootstrap 按钮组?

标签 html css twitter-bootstrap

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="btn-group" role="group" aria-label="...">
  <button type="button" class="btn btn-default">Left</button>
  <button type="button" class="btn btn-default">Middle</button>
  <button type="button" class="btn btn-default">Right</button>
</div>

我正在尝试在从右到左 (RTL) 页面上使用 Bootstrap 按钮组。

但是,按钮被翻转了。 flex 的边缘不在组的外边缘,而是在中间按钮旁边。

我正在使用此处引用的代码:Buttons Group. Basic Example.

结果是这样的: enter image description here

我在 Bootstrap 代码的主 div 标签中添加了一个内联样式,但它没有改变任何内容:

<div class="btn-group btn-group-justified" style="direction:rtl;" role="group" aria-label="...">

所以我的问题是:如何以在 RTL 页面上正确显示的方式设置按钮样式?

提前致谢。

编辑:

似乎所有 Bootstrap 按钮对我来说都存在 RTL 问题。 我尝试了一种不同的类型:拆分按钮下拉菜单使用代码 in this page 这是结果: enter image description here

虽然它在 Bootstrap 文档中是这样显示的: enter image description here

我尝试添加 direction:rtl,但同样没有任何区别。

最佳答案

我遇到了这个问题。我更改了三个 Bootstrap 类; 第一:

.btn-group > .btn,
.btn-group-vertical > .btn {
  position: relative;
  float: left; // => right
}

第二个:

.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 0; //change right to left
          border-bottom-right-radius: 0; //change right to left
}

最后:

.btn-group > .btn:last-child:not(:first-child),
.btn-group > .dropdown-toggle:not(:first-child) {
  border-top-left-radius: 0; // change left to right
  border-bottom-left-radius: 0; // change left to right
}

关于html - 如何在 RTL 页面中显示 Bootstrap 按钮组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47929569/

相关文章:

html - 悬停不覆盖整个文本

html - 当有一些其他内容 float 时,如何让 html 表格单元格中的内容居中?

twitter-bootstrap - 如何使用 Simple Form 和 Bootstrap 将提交按钮放置在与输入相同的行上?

php - Facebook 社交评论插件无法链接到帖子内容

javascript - 在通过 ajax 发布到数据库时试图转义 URI。我究竟做错了什么?

javascript - 移动浏览器中的正文边距问题

css - React 应用程序无法正确呈现

javascript - 修改也包含输入(复选框)的标签文本

html - 从表格边框、棋盘 HTML 中排除行

javascript - JS错误: Uncaught TypeError: Cannot set property 'value' of null