要使用Bootstrap创建圆形,请使用rounded-circle类。
在<div>中添加圆形类
<div class="test rounded-circle"> </div>
上面,我们还有一个测试类,它是一个CSS类,用于设置圆圈的样式-
.test {
width: 270px;
height: 320px;
background-color: yellow;
}您可以尝试运行以下代码以在Bootstrap 4中实现圆形类-
<!DOCTYPE html>
<html>
<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: 350px;
height: 320px;
background-color: yellow;
}
</style>
</head>
<body>
<div class="container">
<h2>Circle</h2>
<p>We have a circle below:</p>
<div class="test rounded-circle"></div>
</div>
</body>
</html>