First, put out the finished picture, as follows:
You can find the basic shape of the player has, but need to be accurate to each direction, can not overflow, the following way to write, paste out the static code:
The HTML is as follows:
<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>Document</title>
<link rel= "stylesheet" href= "Css/main.css" >
<link rel= "stylesheet" href= "Font-awesome-4.7.0/css/font-awesome.min.css" >
<script src= ' js/jquery-1.9.1.min.js ' ></script>
<script src= ' js/main.js ' ></script>
<body>
<div class= "Container" >
<div class= "Big" >
<div class= "Up" ></div>
<div class= "Down" ></div>
<div class= "left" ></div>
<div class= "right" ></div>
<div class= "Up-text" ><span class= "fa fa-chevron-up" ></span></div>
<div class= "Down-text" ><span class= "fa Fa-chevron-down" ></span></div>
<div class= "Left-text" ><span class= "fa fa-chevron-left" ></span></div>
<div class= "Right-text" ><span class= "fa fa-chevron-right" ></span></div>
<div class= "Mid" >
<div class= "small" >
<p> OK </p>
</div>
</div>
</div>
</div>
</body>
The CSS is as follows:
*{
margin:0;
padding:0;
}
div{
Box-sizing:border-box;
}
. container{
width:300px;
height:300px;
Background: #3C5192;
border-radius:50%;
margin:0 Auto;
margin-top:20px;
position:relative;
Overflow:hidden;
Transform:rotate (45DEG);
}
. big{
width:300px;
height:300px;
Background: #3C5192;
border-radius:50%;
margin:0 Auto;
Transform:rotate ( -45DEG);
position:relative;
Overflow:hidden;
}
. mid{
width:150px;
height:150px;
Position:absolute;
top:50%;
margin-top:-75px;
Background: #4A639F;
left:50%;
margin-left:-75px;
border-radius:50%;
}
. small{
width:120px;
height:120px;
Position:absolute;
top:50%;
margin-top:-60px;
Background: #3C5192;
left:50%;
margin-left:-60px;
border-radius:50%;
Text-align:center;
Color: #A2BAE9;
font-size:20px;
Font-weight:bold;
line-height:120px;
}
. up{
height:150px;
width:150px;
Background: #ccc;
Position:absolute;
left:0;
top:0;
Transform:rotate (45DEG);
transform-origin:100% 100%;
}
. down{
height:150px;
width:150px;
Background:green;
Position:absolute;
right:0;
bottom:0;
Transform:rotate (45DEG);
transform-origin:0% 0%;
}
. left{
height:150px;
width:150px;
background:red;
Position:absolute;
left:0;
bottom:0;
Transform:rotate (45DEG);
transform-origin:100% 0%;
}
. right{
height:150px;
width:150px;
Background:blue;
Position:absolute;
right:0;
top:0;
Transform:rotate (45DEG);
transform-origin:0% 100%;
}
. up-text{
Position:absolute;
left:50%;
top:30px;
font-size:22px;
margin-left:-11px;
Color: #90B8E4;
text-shadow:0 0 4px #A2BAE9;
}
. down-text{
Position:absolute;
left:50%;
bottom:30px;
font-size:22px;
margin-left:-11px;
Color: #90B8E4;
text-shadow:0 0 4px #A2BAE9;
}
. left-text{
Position:absolute;
top:50%;
left:30px;
font-size:22px;
margin-top:-11px;
Color: #90B8E4;
text-shadow:0 0 4px #A2BAE9;
}
. right-text{
Position:absolute;
top:50%;
right:30px;
font-size:22px;
margin-top:-11px;
Color: #90B8E4;
text-shadow:0 0 4px #A2BAE9;
}
If you finish writing, then add JS can be very accurate:
$ (function () {
$ ('. Up,.up-text '). Click (function () {
Alert (' Up ');
})
$ ('. Down,.down-text '). Click (function () {
Alert (' Down ');
})
$ ('. Left,.left-text '). Click (function () {
Alert (' left ');
})
$ ('. Right,.right-text '). Click (function () {
Alert (' right ');
})
})
A player is basically finished!
Make a player with pure CSS