css - 使用 Bootstrap 4 Modal 使标签右对齐

标签 css twitter-bootstrap label bootstrap-4

如何使这个标签正确对齐?我只能将它左对齐。我必须将 justify-content: center 的 bootstrap 4 默认值覆盖为 justify-content: right !important; 但它向左对齐。如何使其右对齐?

<div class="modal-body">
    <form class="form-horizontal">
        <div class="form-inline">
            <label class="col-md-4">Type</label>
            <input class="col-md-8" type="email" class="form-control">
        </div>
    </form>
</div>

CSS:

div.form-inline label.col-md-4 {
    justify-content: right !important; 
}

enter image description here

最佳答案

添加类“text-right”到标签

<div class="modal-body">
    <form class="form-horizontal">
        <div class="form-inline">
            <label class="col-md-4 text-right">Type</label>
            <input class="col-md-8" type="email" class="form-control">
        </div>
    </form>
</div>

关于css - 使用 Bootstrap 4 Modal 使标签右对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46338724/

相关文章:

javascript - 如何在完整日历中制作固定标题

html - IE6 和 7 的标记/CSS 背景图形问题

CSS mozilla 过渡不起作用

javascript - 菜单选项卡颜色应与页面刷新前保持一致?

javascript - 在响应选项卡内 Bootstrap 响应表

javascript - Bootbox - 如何动态更改消息内容?

删除 R Spie 图中的标签边框

html - 如何在Bootstrap 3中水平对齐标签并选择标签?

c# - 重新发明标签控件

c# - 禁用控件的文本颜色 - 如何更改它