在 Bootstrap 中为元素设置深色边框

bootstrapweb developmentcss framework

如果要为元素设置深色边框,请使用 border-dark 类。

区分普通边框和深色边框 −

要添加深色边框,您只需像在 div 中添加其他类一样添加它,如下所示 −

<div class="myclass border border-dark">
  深色边框
</div>

以上测试的是 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>

相关文章