复选框输入未与标签居中

时间:2018-12-29 16:50:57

标签: css checkbox bootstrap-4

text-center将标签“选中此自定义复选框”居中,但输入仍保留在左侧。

如果删除该custom-control-input类,则会看到一个新的复选框输入,该输入将居中,并且引导程序输入仍将留在左侧,并且无法单击。

我想把整个事情放在中心。

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <div class="custom-control custom-checkbox text-center">
      <input type="checkbox" class="custom-control-input" id="customCheck1">
      <label class="custom-control-label" for="customCheck1">Check this custom checkbox</label>
    </div>

3 个答案:

答案 0 :(得分:1)

使用Bootstrap 4.1或更高版本(如最新的4.2.1版本)。 custom-control-label从Bootstrap 4.1开始更改为position:relative,这将使复选框和标签都居中。

Demo

答案 1 :(得分:0)

尝试此标记:

<label class="custom-control-label" for="customCheck1"><input type="checkbox" class="custom-control-input" id="customCheck1" />Check this custom checkbox</label>

答案 2 :(得分:0)

您可以尝试使用此代码,

仅告诉您当前的div 'd-inline-block',这是引导程序类,包装一个容器类并添加文本中心

mov eax, 5
mov edx, 5
mov ebx, 11
add eax, edx
cmp eax, ebx
jg return1
mov eax, 0
jmp return2
return1:
mov eax, 1
return2:

相关问题