在 Bootstrap 中設定元素的深色邊框


如果你希望為元素設定深色邊框,請使用 border-dark 類。

發現普通邊框和深色邊框之間的差異 -

為了新增深色邊框,就像在 div 中新增任何其他類一樣,只需新增即可,如下所示 -

<div class="myclass border border-dark">
  Dark Border
</div>

上面,test 是 CSS 樣式,我用來設計我的矩形 (div) -

.myclass {
  width: 150px;
  height: 150px;
  margin: 35px;
}

讓我們看看如何在 Bootstrap 4 中使用 border-dark 類 -

示例

現場演示

<!DOCTYPE html>
<html>
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
    <style>
      .myclass {
         width: 150px;
         height: 150px;
         margin: 35px;
      }
    </style>
</head>
<body>

<div class="container">
  <p>Rectangles with normal and dark border:</p>
  <div class="myclass border">Normal Border</div>
  <div class="myclass border border-dark">Dark Border</div>
</div>
</body>
</html>

更新於: 2020-06-15

86 次瀏覽

開始你的 職業生涯

透過完成課程獲取認證

開始
廣告
© . All rights reserved.