在 Bootstrap 4 中移除元素的顶部边框

bootstrapweb developmentcss framework

使用 border-top-0 类移除元素的顶部边框。

设置该类的方式与向元素添加其他类 − 一样

<div class="mystyle border border-top-0">
  顶部边框缺失
</div>

上面,我已将 <div> 作为我们的元素。还添加了另一个类 “mystyle” 用于设置 div − 的样式。

.mystyle {
  width: 350px;
  height: 170px;
  margin: 10px;
}

您可以尝试运行以下代码,以便在 Bootstrap 4 中使用 border-top-0 类 −

示例

<!DOCTYPE html>
<html lang="en">
  <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>
    .mystyle {
      width: 350px;
      height: 170px;
      margin: 10px;
    }
    </style>
  </head>
<body>

<div class="container">
  <h2>Rectangle</h2>
  <div class="mystyle border border-top-0">Top border is missing</div>
</div>

</body>
</html>

相关文章