正如标题所说,我想在我的图像周围添加一个圆形边框,我已经知道了
border-radius: 50%;
但是由于我的图像尺寸发生了变化,所以它变成了一个椭圆。那么如何在我的图像周围放置一个圆形边框呢?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Visit Citrus County</title>
</head>
<body>
<div class="block1">
<h1 id="title">Welcome to Citrus County</h1>
<h2 id="sub-title"> Home of the Manatees, and Great Wildlife!</h2>
</div>
<div class="block2">
<h1 id="things"> Top Three Activites to do in <span id="citrus-county">Citrus County.</span></h1>
<div id="activites">
<img id="kayaking" src="images/kayaking.jpg">
<img id="swim" src="images/swim-with-manatee.jpg">
<img id="hike" src="images/hiking.jpg">
</div>
</div>
</body>
</html>
[Code ->](https://jsfiddle.net/uo07xthy/)
给出图像宽度和
aspect-ratio:1
.
img {
width: 200px;
border-radius: 50%;
aspect-ratio: 1;
border: 1px solid red;
}
<img id="kayaking" src="images/kayaking.jpg">