.section.lollipop
.container
.heart
.heart-face
.stick
.heart
.heart-face
.line-eraser
.highlight
.face
.section.donut
.container
.donut-body
.face
.highlight
.section.ice-cream
.container
.bottom
.top
.scoop
.scoop
.scoop
.scoop
.top-scoop
.highlight
.face
.section.cupcake
.container
.top
.cream
.highlight
.cream
.highlight
.cream
.highlight
.cream
.highlight
.bottom
.bottom-in
.face
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
$black: #003459;
$yellow: #fff09b;
$apricot: #f4c99f;
$lavender: #cbcded;
$pink: #faa7a8;
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
html,
body {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
body {
position: relative;
display: flex;
flex-wrap: wrap;
}
.section {
display: flex;
align-items: center;
justify-content: center;
flex-grow: 1;
width: 50%;
}
.section:first-child {
background-color: $apricot;
}
.section:nth-child(2) {
background-color: $yellow;
}
.section:nth-child(3) {
background-color: $pink;
}
.section:nth-child(4) {
background-color: $lavender;
}
.container {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
width: 200px;
height: 200px;
}
.face {
border-bottom-left-radius: 100px;
border-bottom-right-radius: 100px;
border: 3px solid $black;
width: 32px;
height: 16px;
border-top: 0;
position: absolute;
top: 46%;
left: 42%;
&:after {
content: "";
border-radius: 50%;
background-color: $black;
width: 8px;
height: 8px;
position: absolute;
top: -150%;
left: -16px;
box-shadow: 48px 0 $black;
}
}
.highlight {
border: 8px solid rgba(255, 255, 255, 0.5);
border-bottom: 0;
border-left: 0;
border-top-right-radius: 50px;
width: 40px;
height: 40px;
z-index: 99;
position: absolute;
right: 30px;
top: 30px;
}
.lollipop {
.heart {
position: absolute;
width: 100%;
height: 100%;
top: -20%;
left: -2%;
}
.heart-face {
background-color: $lavender;
width: 100px;
height: 100px;
position: absolute;
border-radius: 10px;
top: 50px;
left: 50px;
transform: rotate(-45deg);
border: 2px solid $black;
&:before {
content: "";
width: 100px;
height: 100px;
border-radius: 50%;
background-color: $lavender;
border: 2px solid $black;
position: absolute;
top: -50px;
left: -2px;
}
&:after {
z-index: -1;
border: 2px solid $black;
content: "";
width: 100px;
height: 100px;
border-radius: 50%;
background-color: $lavender;
position: absolute;
top: -2px;
left: 45px;
}
.line-eraser {
width: 104%;
height: 103%;
top: -3%;
position: absolute;
background-color: $lavender;
border-radius: 10px;
}
}
.heart:nth-child(1) .heart-face {
top: 48px;
left: 55px;
transform: rotate(-45deg) scale(1.02);
// position: relative;
background-color: darken($lavender, 20%);
&:before,
&:after {
background-color: darken($lavender, 20%);
}
}
.stick {
border: 2px solid $black;
height: 120px;
width: 10px;
position: absolute;
bottom: -40px;
left: 47%;
background-color: #f0f0f0;
border-radius: 0 0 4px 4px;
}
}
.donut {
.donut-body {
width: 100%;
height: 100%;
border-radius: 50%;
background-color: darken($pink, 10%);
border: 2px solid $black;
&:before {
content: "";
position: absolute;
width: 92%;
height: 92%;
top: 4px;
right: 4px;
background-color: $pink;
border-radius: 50%;
}
&:after {
content: "";
position: absolute;
width: 30%;
height: 30%;
top: 35%;
left: 35%;
background-color: $yellow;
border-radius: 50%;
border: 2px solid $black;
}
}
.face {
top: 22%;
left: 42%;
&:after {
}
}
.highlight {
border-bottom: 0;
border-left: 0;
border-top-right-radius: 50px;
width: 40px;
height: 40px;
left: 50px;
top: 105px;
transform: rotate(180deg);
}
}
.ice-cream {
.bottom {
position: absolute;
border-style: solid;
border-width: 50px 100px 50px 0;
border-color: transparent;
border-right-color: $black;
transform: rotate(-90deg) scale(1.3);
top: 42%;
&:before {
position: absolute;
content: "";
width: 100%;
height: 100%;
top: 0;
left: -50%;
border-style: solid;
border-width: 50px 100px 50px 0;
border-color: transparent;
border-right-color: darken(#ffd180, 20%);
transform: translateY(-50%) scale(0.94);
}
&:after {
position: absolute;
content: "";
width: 100%;
height: 100%;
top: 0;
border-style: solid;
border-width: 50px 100px 50px 0;
border-color: transparent;
border-right-color: #ffd180;
transform: translate(10%, -45%) scale(0.9);
}
}
.top {
position: absolute;
width: 70%;
height: 42%;
border-radius: 80px 80px 5% 5%;
background-color: darken($apricot, 10%);
top: 0%;
border: 2px solid $black;
.top-scoop {
&:after {
content: "";
position: absolute;
width: 90%;
height: 114%;
right: 1px;
top: 4%;
border-radius: 80px 80px 5% 5%;
background-color: $apricot;
}
}
.scoop {
position: absolute;
border-radius: 50%;
width: 50px;
height: 50px;
bottom: -30%;
left: -5px;
background-color: $apricot;
border: 2px solid $black;
}
.scoop:nth-child(2) {
left: 27px;
}
.scoop:nth-child(3) {
left: 60px;
}
.scoop:nth-child(4) {
left: 91px;
}
.scoop:nth-child(1) {
&:after {
position: absolute;
content: "";
width: 105%;
height: 105%;
background-color: $apricot;
border-radius: 50%;
top: -3px;
}
}
.line-eraser {
position: absolute;
background-color: #e6eeca;
width: 100%;
// height: 42px;
bottom: -14px;
border-radius: 10px;
}
}
.face {
top: 32%;
left: 42%;
z-index: 3;
}
.highlight {
right: 15px;
top: 15px;
}
}
.cupcake {
.bottom {
width: 60%;
height: 50%;
bottom: -7px;
position: absolute;
perspective: 200px;
z-index: 1;
.bottom-in {
background-color: darken(#ffd180, 20%);
border: 2px solid $black;
width: 100%;
height: 100%;
transform: rotateX(-20deg);
border-radius: 5px 5px 10px 10px;
&:after {
content: "";
position: absolute;
background-color: #ffd180;
width: 90%;
height: 100%;
right: 0;
border-radius: 5px 5px 10px 10px;
}
}
}
.top {
position: absolute;
bottom: 43%;
width: 70%;
height: 50%;
z-index: 2;
}
.cream {
position: absolute;
border-radius: 30px;
border: 2px solid $black;
background-color: darken($yellow, 10%);
height: 40px;
width: 100%;
left: 0%;
bottom: 0%;
transform: rotate(4deg);
z-index: 4;
&:after {
content: "";
position: absolute;
height: 100%;
width: 90%;
background-color: $yellow;
top: 0;
right: 0;
border-radius: 30px;
}
}
.cream:nth-child(2) {
width: 90%;
left: 5%;
bottom: 25px;
z-index: 3;
}
.cream:nth-child(3) {
width: 70%;
left: 15%;
bottom: 50px;
z-index: 2;
}
.cream:nth-child(4) {
width: 50%;
left: 25%;
bottom: 33px;
z-index: 1;
transform: rotate(45deg);
height: 70%;
border-radius: 15px;
}
.highlight {
right: 7%;
top: 10%;
width: 15px;
height: 15px;
border-width: 6px;
}
.face {
left: 38%;
}
}
@media screen and (max-width: 480px) {
.section {
width: 100%;
height: 320px;
}
}