.cloud { position: relative; width: 200px; height: 150px; background-color: #A8DCEA; border-radius: 0 0 80px 80px; } .cloud:before, .cloud:after { content: ""; position: absolute; background-color: white; border-radius: 100%; } .cloud:before { width: 70px; height: 70px; top: -20px; left: 50px; } .cloud:after { width: 80px; height: 80px; top: -15px; left: 120px; }
代码说明:
- 使用position属性设置云朵的位置为相对定位。
- 将整个云朵的宽度设为200px、高度为150px。
- 设定云朵整体的背景颜色为#A8DCEA,同时设置它的边框为不规则形状,这是通过设置border-radius属性来实现的。
- 使用:before和:after伪元素来创建两个白色的圆形元素,这两个元素分别通过top和left属性对它们的位置进行调整。
使用以上CSS代码,结合一定的HTML代码,即可实现非常漂亮的CSS云朵logo。除了上述代码,大家还可以通过动画效果增强其美观性。