Skip to content

Instantly share code, notes, and snippets.

@tai-cha
Created January 25, 2020 16:43
Show Gist options
  • Save tai-cha/6e23f1c5abe2de11fe2bf88c1f274fc8 to your computer and use it in GitHub Desktop.
Save tai-cha/6e23f1c5abe2de11fe2bf88c1f274fc8 to your computer and use it in GitHub Desktop.
CSSだけで顔が描きたかった
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div class="top">
<div class="kao">
<div class="eye left"></div>
<div class="eye right"></div>
<div class="nose"></div>
</div>
</div>
</body>
<style>
.top {
position: relative;
}
.kao {
content: '';
position: absolute;
top: 10px;
left: 10px;
width: 300px;
height: 400px;
border-radius: 43%;
background-color: bisque;
z-index: 1;
}
.eye {
content: '';
position: absolute;
background-color: black;
border-radius: 50%;
width: 60px;
height: 50px;
z-index: 2;
}
.eye.left {
top: 150px;
left: 50px;
}
.eye.right {
top: 150px;
right: 50px;
}
.eye::before {
content: '';
position: absolute;
top: 15px;
left: 25px;
width: 20px;
height: 20px;
background-color: white;
border-radius: 50%;
}
.nose {
position: absolute;
border: 1px solid black;
border-top: none;
border-right: none;
width: 15px;
height: 30px;
top: 220px;
left: 140px;
transform: rotateZ(15deg);
}
</style>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment