在 Bootstrap 4 中移除一個元素的頂部邊框


使用 border-top-0 類來從一個元素移除頂部邊框。

設定這個類就像我們給元素新增其它類一樣 −

<div class="mystyle border border-top-0">
  Top border is missing
</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>

更新於: 16-6-2020

2K+ 瀏覽量

開啟你的 職業生涯

透過完成課程獲得認證

開始學習
廣告
© . All rights reserved.