Bootstrap 4 border class不适用于top,right

时间:2017-11-03 18:58:50

标签: html css bootstrap-4

我正在尝试使用bootstrap 4 border为div提供边框。只有边界属性,它看起来很奇怪,而其他属性没有出现边框。请在下面找到代码段。

我也试过了beta 2版本。

如果我遗失了某些内容,请告诉我。



<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Home</title>
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
</head>

<body>
    <!-- Just created a contianer to test the border class -->
    <div class="container">
        <div class="text-center">
            <h1> Testing bootstrap 4</h1>
        </div>
        <div class="row mt-2">
            <div class="col-12">
                <!-- Testing span with class border -->
                <span class="border">
                <div class="text-primary">Testing Bootsrap 4 Border </div>
            </span>
            </div>
        </div>
        <div class="row mt-2">
            <div class="col-12">
                <span class="border-0">Testing Bootsrap 4 Border 0</span>
            </div>
        </div>
        <div class="row mt-2">
            <div class="col-12">
                <span class="border-top-0">Testing Bootsrap 4 Border top 0</span>
            </div>
        </div>
        <div class="row mt-2">
            <div class="col-12">
                <span class="border-right-0">Testing Bootsrap 4 Border right 0</span>
            </div>
        </div>
        <div class="row mt-2">
            <div class="col-sm-12">
                <span class="border border-light">testing border light</span>
            </div>
            <div class="col-sm-12"> col 2</div>
        </div>
    </div>
</body>

</html>
&#13;
&#13;
&#13;

3 个答案:

答案 0 :(得分:2)

这是减法边界,因此首先,您需要一个边界,因此您需要首先包括该边界类。

 <span class="border border-top-0"></span>

要更有效地查看它,请尝试以下操作:

 <span class="border border-top-0 p-2 border-primary">Border</span>

使用上下文类和填充实用程序,您可以轻松获得不同。

答案 1 :(得分:1)

要使bootstrap边框起作用,您必须添加border类。例如,当你写<span class="border-right-0">时,它表明没有边框应该在右边。你没有开始说明边界,所以没有边界显示。您需要做的是<span class="border border-right-0">

答案 2 :(得分:0)

嘿,你只需要添加一些类来显示边界,即边界边界 - 主边界,边界边界 - 次边等。

&class&#34; border border-0&#34;意味着没有边界。

  

在课堂上=&#34;边框边界灯&#34;,&#34;边界灯&#34;是另一种语境边框颜色。

以下是有用的课程:

  

您可以使用以下类的上下文边框颜色列表:

     

边界主

     

边界次级

     

边界 - 白

     

边界 - 暗

     

边界 - 光

     

边界信息

     

边界警告

     

边界危险

     

边界成功

如果您想要变得更轻松,请尝试https://www.w3schools.com/bootstrap4/bootstrap_utilities.asphttps://v4-alpha.getbootstrap.com/utilities/borders/

&#13;
&#13;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<title>Home</title>
</head>
<body>
    <!-- Just created a contianer to test the border class -->
    <div class="container">
        <div class="text-center">
            <h1> Testing bootstrap 4</h1>
        </div>
        <div class="row mt-2">
            <div class="col-12">
                <!-- Testing span with class border -->
                <span class="border">

                <div class="text-primary">Testing Bootsrap 4 Border </div>

            </span>
            </div>
        </div>
        <div class="row mt-2">
            <div class="col-12">
                <span class="border-0 border border-primary">Testing Bootsrap 4 Border 0</span>
            </div>
        </div>
        <div class="row mt-2">
            <div class="col-12">
                <span class="border border-primary border-top-0">Testing Bootsrap 4 Border top 0</span>
            </div>
        </div>
        <div class="row mt-2">
            <div class="col-12">
                <span class="border border-danger border-right-0">Testing Bootsrap 4 Border right 0</span>
            </div>
        </div>
        <div class="row mt-2">
            <div class="col-sm-12">
                <span class="border border-light">testing border light</span>
            </div>
            <div class="col-sm-12"> col 2</div>
        </div>
    </div>
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
</body>

</html>
&#13;
&#13;
&#13;