使用border-primary类向Bootstrap 4中的元素添加蓝色边框,如下所示:
将类设置为-
<div class="demo border border-primary"> Blue Border </div>
您可以尝试运行以下代码以实现border-primary类-
<!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> .demo { width: 250px; height: 170px; margin: 10px; } </style> </head> <body> <div class="container"> <h3>Demo Heading</h3> <div class="demo border border-primary">Blue Border</div> </div> </body> </html>