在Bootstrap 4中使用border-secondary类为元素添加灰色边框。
将边框设置为-
<div class="test border border-secondary"> Gray border </div>
我已经为元素<div>设置了样式,如以下代码片段所示:
<style> .test { width: 200px; height: 150px; margin: 10px; } </style>
您可以尝试运行以下代码以实现border-secondary类-
<!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> .test { width: 200px; height: 150px; margin: 10px; } </style> </head> <body> <div class="container"> <h2>Rectangle</h2> <div class="test border border-secondary">Gray border</div> </div> </body> </html>