要将顶部圆角添加到元素,请使用Bootstrap 4中的rounded-top类。
我已经将div作为元素-
<div class="new rounded-top"></div>
让我们学习如何向元素添加顶部圆角-
<!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> .new { width: 80px; height: 80px; background-color: #EE6D1E; margin: 20px; } </style> </head> <body> <div class="container"> <h2>Rounded Corner</h2> <p>We have a rectangle with top rounded corner:</p> <div class="new rounded-top"></div> </div> </body> </html>