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.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
   <script src="https://maxcdn.bootstrapcdn.com/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 次瀏覽

開啟你的職業生涯

透過學習該課程來獲得認證

開始
廣告