使用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://cdn.staticfile.org/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>