Skip to content

Instantly share code, notes, and snippets.

@veritstudio
Last active November 25, 2019 19:47
Show Gist options
  • Save veritstudio/74dbbe6331e5bfa37ddea41bc8cc3b84 to your computer and use it in GitHub Desktop.
Save veritstudio/74dbbe6331e5bfa37ddea41bc8cc3b84 to your computer and use it in GitHub Desktop.
Build shapes with CSS only
.circle {
width: 200px;
height: 200px;
background: #00a1de;
border-radius: 50%
}
.cone {
border-left: 140px solid transparent;
border-right: 140px solid transparent;
border-top: 200px solid #00a1de;
border-radius: 50%;
height: 0;
width: 0;
}
.egg {
display: block;
width: 252px;
height: 360px;
background-color: #00a1de;
border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.heart {
position: relative;
width: 200px;
height: 180px;
}
.heart:before,
.heart:after {
position: absolute;
content: "";
left: 100px;
top: 0;
width: 100px;
height: 160px;
background: #00a1de;
border-radius: 100px 100px 0 0;
transform: rotate(-45deg);
transform-origin: 0 100%;
}
.heart:after {
left: 0;
transform: rotate(45deg);
transform-origin: 100% 100%;
}
.oval {
width: 300px;
height: 150px;
background: #00a1de;
border-radius: 150px / 75px;
}
.pacman {
width: 0px;
height: 0px;
border-right: 120px solid transparent;
border-top: 120px solid #00a1de;
border-left: 120px solid #00a1de;
border-bottom: 120px solid #00a1de;
border-top-left-radius: 120px;
border-top-right-radius: 120px;
border-bottom-left-radius: 120px;
border-bottom-right-radius: 120px;
}
.rectangle {
width: 300px;
height: 150px;
background: #00a1de;
}
.six-points-star {
width: 0;
height: 0;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
border-bottom: 200px solid #00a1de;
position: relative;
}
.six-points-star:after {
width: 0;
height: 0;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
border-top: 200px solid #00a1de;
position: absolute;
content: "";
top: 60px;
left: -100px;
}
.square {
width: 200px;
height: 200px;
background: #00a1de;
}
.trapezoid {
border-bottom: 150px solid #00a1de;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
height: 0;
width: 200px;
}
.triangle-up {
width: 0;
height: 0;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
border-bottom: 200px solid #00a1de;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment