css - React-bootstrap:反转复选框输入,使标签文本排在第一位

标签 css react-bootstrap

我有一个由 react-bootstrap 生成的复选框,它呈现为包含输入标签和标签标题的标签。 我想要它,以便标签标题排在第一位。

来自 react-bootstrap 的复选框:

<Checkbox
   checked={checkedStatus}
   onChange={(e) => this.handleToggle(e, checkBoxValue)}
>{title}</Checkbox>

呈现的 HTML:

<div class="checkbox">
    <label title="">
        <input type="checkbox" value="">
        Did not perform
    </label>
</div>

输出:

enter image description here

最佳答案

我使用 flex 通过改变行方向来解决这个问题。

HTML:

<div class="checkbox">
    <label title="">
        <input type="checkbox" value="">
        Did not perform
    </label>
</div>

CSS:

div.checkbox {
  display: inline-block;
  /*ie7 -- start*/
  *display: inline;
  zoom: 1;
}

div.checkbox > label {
  display: flex;
  flex-direction: row-reverse;
}

输出:

enter image description here

JSFiddle:here

关于css - React-bootstrap:反转复选框输入,使标签文本排在第一位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53118202/

相关文章:

html - CSS扩展div的宽度以覆盖左侧的div

html - 如何在 css 背景图像 : url() function? 中使用谷歌驱动器图像

javascript - 覆盖现有的react.js类

javascript - 使用 ajax 数据响应 Bootstrap 表

javascript - 如何将带有子项的 react-bootstrap 组件导入 kotlin-js react app

css - 如何调整我的主题,以便所有元素(例如,标题中的搜索)在更改屏幕大小后保持其位置?

javascript - Bootstrap 3 导航栏部分

javascript - React 中条件渲染的转换问题

html - 如何使无序列表居中?

css - 在 react-bootstrap 中更改 NavDropdown 的颜色和背景颜色