属性介绍:
border-radius 属性允许我们为元素添加圆角边框。
语法:
border-radius: 1-4 length|% / 1-4 length|%;
注意: 每个半径的四个值的顺序是:左上角,右上角,右下角,左下角。如果省略左下角,右上角是相同的。如果省略右下角,左上角是相同的。如果省略右上角,左上角是相同的。
属性值:
-
length 定义弯道的形状。
-
% 使用%定义角落的形状。
具体实现代码如下:
(学习视频分享:CSS视频教程)
style{
.circle{
width:120px;
height:120px;
border-radius:50%;
overflow:hidden;
}
.circle > img{
width: 100%;
height: 100%;
}
}
<div class="circle">
<img src="你的图片" alt="正方形的原始图片" />
</div>
