纯css布局实现杯中蛋糕效果
代码语言:html
所属分类:布局界面
代码描述:纯css布局实现杯中蛋糕效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-size: 16px;
}
*:before,
*:after {
content: "";
position: absolute;
}
.container {
height: 80vh;
width: 80em;
max-width: 80%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
}
@media only screen and (max-width: 48em) {
.container {
flex-wrap: wrap;
height: 100%;
}
}
.dessert {
position: relative;
width: 25%;
height: 50%;
display: flex;
flex-direction: column;
align-items: center;
}
@media only screen and (max-width: 48em) {
.dessert {
width: 50%;
}
}
.dessert::before {
width: 8em;
height: 1em;
background: radial-gradient(ellipse at 45% 60%, #f0f1f4cc, transparent);
border-radius: 50%;
bottom: 0;
}
.dessert .cup {
position: absolute;
width: 7.8em;
height: 3.75em;
bottom: 0.5em;
background: lightblue;
clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 10.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0