【问题标题】:Why is the border-left border-right not working for Bootstrap 5 Django?为什么左边界右边界不适用于 Bootstrap 5 Django?
【发布时间】:2020-12-23 19:54:00
【问题描述】:

所以我有以下代码:

{% load static %}

<!DOCTYPE html>
<html>
<head>
    <title>Verification Code Email</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
    <style>
        .insta-icon{width:50%; float:right;}
    </style>    
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-1 offset-1 border-right">    # This one right here
                <img class="insta-icon"src="{% static '/images/instagram_icon.png' %}">                 
            </div>
            <div class="col-10"> b</div>
        </div>
    </div>
    <div class="container">
    </div>


    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
</body>

</html>

现在,当我只执行border 时,会显示边框,当我执行border-bottomborder-top 时,会显示边框。但是,当我使用border-leftborder-right 时,不会显示边框轮廓。

另外,我尝试通过向 div 类添加 insta-nav 类来使用样式,并通过添加 border:1px 覆盖样式,但没有添加边框。

为什么这两个原因会这样?任何帮助将不胜感激

【问题讨论】:

    标签: django border bootstrap-5


    【解决方案1】:

    您需要在引导程序 5 中使用 border-startborder-end 而不是 border-leftborder-right

    水平方向敏感的变量、实用程序和 mixin 用更多逻辑名称重命名 — startend 代替 Bootstrap 5 中的 leftright

    您可以在此处查看更多 bootstrap 5 迁移详细信息: https://getbootstrap.com/docs/5.0/migration/#sass

    【讨论】:

    • 在我看来这真的很烦人。他们可能只是让它进来,或者增加使用 mixin 或其他东西启用旧样式的可能性。当我想要一个margin-right“先生”时,这是有道理的——即使你不知道bootstrap,你也会很容易理解它并几乎立即在你的脑海中翻译它。 LTR 支持很简洁——如果你需要的话——我不需要。对我可能不需要的功能进行抽象层会留下不好的味道。会试一试,但 99% 肯定我最终会在我自己的 css 中声明所有“旧”边距/填充变化:/
    猜你喜欢
    • 2022-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-04
    • 1970-01-01
    • 2018-04-16
    • 2019-01-07
    • 2020-01-16
    相关资源
    最近更新 更多