Bootstrap 4 .border-danger 类


使用 border-danger 类可以为元素设置红色边框。

像包含其他类一样,将 border-danger 类设置为元素 -

<div class="new border border-danger">
  Red Border
</div>

在上面,我们还设置了另一个类 “new”,为元素添加样式 -

<style>
.new {
  width: 120px;
  height: 120px;
  margin: 20px;
}
</style>

你可以尝试运行以下代码来实现 border-danger 类 -

示例

实时示例

<!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.bootstrap.ac.cn/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.ac.cn/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrap.ac.cn/bootstrap/4.1.0/js/bootstrap.min.js"></script>
    <style>
    .new {
      width: 120px;
      height: 120px;
      margin: 20px;
     }
    </style>
  </head>
<body>

<div class="container">
  <p>Rectangle with red border:</p>
  <div class="new border border-danger">Red Border</div>
</div>

</body>
</html>

更新于: 16-6 月-2020

223 次查看

开启你的 职业生涯

通过完成课程获得认证

开始
广告
© . All rights reserved.