css - 为什么 pull-right 类在 bootstrap 版本 4.1.0 上不起作用?

标签 css bootstrap-4

之前我们使用 bootstrap 版本 3+。现在我们使用4.1.0。当我尝试使用 pull-right 和 pull-left 对齐时,它不起作用。即使我尝试使用 float 右/ float 左它也不起作用。 Click here to see image (我在图像中提到了它的显示位置以及我希望它显示的位置)

这里的代码:

<nav class="navbar navbar-static-top">
        <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
    <span class="sr-only">Toggle navigation</span>
        </a>
    <div class="header_text float-left ">Home</div>
    <div class="header_text float-right">Company Name</div>
    <div class="navbar-custom-menu ">
    <ul class="nav navbar-nav">
    <li class="dropdown user user-menu">
    <a href="#" class="dropdown-toggle float-right" data-toggle="dropdown"> <img src="./Images/user2-160x160.jpg" class="user-image" alt="User Image"> <span class="hidden-sm">Welcome</span> </a>
    <ul class="dropdown-menu">
        </ul>
    </li>
    </ul>
    </div>
    </nav>

在上面的代码中,我尝试使用 pull-rightpull-left起初,然后之后 我用过一些谷歌搜索float-leftfloat-right .仍然没有达到我预期的结果。请帮忙

供@soheilPs引用I add image here

最佳答案

检查变更日志: https://getbootstrap.com/docs/4.0/migration/#utilities

Added .float-{sm,md,lg,xl}-{left,right,none} classes for responsive floats and removed .pull-left and .pull-right since they’re redundant to .float-left and .float-right.

所以在你的情况下应该是

class="float-sm-right"

关于css - 为什么 pull-right 类在 bootstrap 版本 4.1.0 上不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50248385/

相关文章:

css - 打印时,Vuetify 应用程序为不可见元素保留空间

html - 在固定位置显示按钮

css - Bootstrap 如何添加 img 与其他 img 对齐

css - 修复警告 "Also define the standard property ' box-shadow' 以实现兼容性”

javascript - 我需要帮助来自动显示 react 类中的方法

jQuery 更改文件夹与 css 更改

HTML: <ul> 标签位于 div 区域的边缘

html - 删除列上的填充使水平滚动条

html - 当内容很长时如何使用中间的最小高度元素

CSS 垂直显示内联 block 而不是水平显示