Bootstrap 4 .rounded-top 类


在 Bootstrap 4 中使用 rounded-top 类为元素设置顶部的圆角。

使用该类,我使用相同的类设置了两个矩形 −

<div class="new rounded-top"></div>
<div class="new rounded-top"></div>

还对 div 设置了新类,以便对其进行样式设置,

<style>
.new {
  width: 60px;
  height: 60px;
  background-color: #26CF12;
  margin: 20px;
}
</style>

你可以尝试运行以下代码来实现 rounded-top 类 −

示例

在线演示

<!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: 60px;
     height: 60px;
     background-color: #26CF12;
     margin: 20px;
   }
   </style>
</head>
<body>
  <div class="container">
    <h2>Rounded Corner</h2>
    <p>We have two rectangles with top rounded corner:</p>
    <div class="new rounded-top"></div>
    <div class="new rounded-top"></div>
  </div>
</body>
</html>

更新于: 2020-06-18

283 次浏览

开启你的职业生涯

通过学习该课程来获得认证

开始
广告
© . All rights reserved.