create a graphic using css - zilongxuan001/LearnFreecode GitHub Wiki
使用多个选择器和属性,你可以创作很多有趣的图。 一个很简单的方法是制作一个新月。
对于这个挑战,你需要使用box-shadow
属性,来设置一个元素的阴影,再设置border-radius
控制元素的圆角。
你可以创造一个圆,然后使用轻移到边上的脆影(crisp shadow)来变形物体,这个阴影就会变成月亮的形状。
为了创造一个圆形物体,border-radius
的属性应该设置为50%。
你可以使用box-shadow
属性的offset--x
、offset-y
、blur-radius
、spread-radius
和color。其中blur-radius
和spread-radius
值是可选的。
在编辑器操纵方块元素变成月亮形状。首先,改变background-color
为透明的,设置border-radius
的属性为50%来创造圆形。最后,改变box-shadow
属性,设置offset-x
为25px,offset-y
为10px,blur-radius
为0,spread-raius
为0,color为blue。
<style>
.center
{
position: absolute;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100px;
height: 100px;
background-color: transparent;
border-radius: 50%;
box-shadow: 25px 10px 0 0 blue;
}
</style>
<div class="center"></div>
Editing create a graphic using css · zilongxuan001/LearnFreecode Wiki
2018-10-31 10:18:35