Html 引导程序4 mr auto无法正常工作
我有一个片段:Html 引导程序4 mr auto无法正常工作,html,css,twitter-bootstrap,bootstrap-4,Html,Css,Twitter Bootstrap,Bootstrap 4,我有一个片段: Войти Регистрация 您应该使用类float right和d-flex而不是mr auto。mr auto用于将页边距right auto设置为不使用向右对齐内容 您希望将内容与col-lg-9中的右侧对齐,因此需要使用col-lg-9将类添加到文本右侧 谢谢。自动边距适用于flexbox容器,但col-lg-9不是flexbox容器。使用d-flex使其成为flexbox容器,然后ml auto将内容推到右侧 <div class="row">
Войти
Регистрация
您应该使用类float right和d-flex而不是mr auto。mr auto用于将页边距right auto设置为不使用向右对齐内容
您希望将内容与col-lg-9中的右侧对齐,因此需要使用col-lg-9将类添加到文本右侧
谢谢。自动边距适用于flexbox容器,但
col-lg-9
不是flexbox容器。使用d-flex
使其成为flexbox容器,然后ml auto
将内容推到右侧
<div class="row">
<div class="col-lg-3">
<div class="logo">
<img src="#" alt="logotype">
</div>
</div>
<div class="col-lg-9 d-flex">
<div class="head-buttons ml-auto">
<a href="">Русский</a>
<div class="auth-buttons">
<button>Войти</button>
<button>Регистрация</button>
</div>
</div>
</div>
</div>
有时,最好使用style标记设置style=“margin left:auto”,这样它就可以完美地工作。您应该添加d-flex justify content endits。。但必须添加对齐文本内容到正确的创可贴建议的内容结束!在我真的很难让ml auto正常工作的时候帮助了我。
<div class="row">
<div class="col-lg-3">
<div class="logo">
<img src="#" alt=" logotype">
</div>
</div>
<div class="col-lg-auto ml-auto">
<div class="head-buttons">
<a href="">Русский</a>
<div class="auth-buttons">
<button>Войти</button>
<button>Регистрация</button>
</div>
</div>
</div>
</div>