Checkbox Bootstrap 5切换前文本复选框(无额外插件)

Checkbox Bootstrap 5切换前文本复选框(无额外插件),checkbox,switch-statement,bootstrap-5,Checkbox,Switch Statement,Bootstrap 5,我使用Bootstrap 5和I wand来使用开关切换 我不想使用任何其他插件,但只与引导 如何将文本置于切换开关之前 这不起作用: <div class="form-check form-switch"> off <input type="checkbox" class="form-check-input" id="site_state"> <label for=&quo

我使用Bootstrap 5和I wand来使用开关切换

我不想使用任何其他插件,但只与引导

如何将文本置于切换开关之前

这不起作用:

<div class="form-check form-switch">
  off
  <input type="checkbox" class="form-check-input" id="site_state">
  <label for="site_state" class="form-check-label">on</label>
</div>

关
在…上

有人有主意吗?

如果您将标签外的内容放在复选框之前,并使所有内容都显示:内联块


关
在…上

您可以将其包装在
d-flex

<div class="d-flex">
    off
    <div class="form-switch ms-2">
        <input type="checkbox" class="form-check-input" id="site_state">
    </div>
    <label for="site_state" class="form-check-label">on</label>
</div>

关
在…上

你好。当然,我也首先想到了“d-inline-block”,但我没有想到在它周围构建一个完整的脚手架。但是这个解决方案是有效的,我非常感谢你!