How does CSS imitate the remote control button
This article mainly explains "how CSS imitates remote control buttons". The explanation in this article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how CSS imitates remote control buttons".
Html structure
+ +-- ok
Css style
.button-group {padding-top: 20rpx; width: 300rpx; height: 300rpx; background-color: pink;}. Outter-circle {position: relative; margin-left: 10rpx; width: 280rpx; height: 280rpx; background-color: lightcyan; border-radius: 100%; overflow: hidden; transform-origin: center; transform: rotate (45deg);} .inner-parts {float: left; width: 140rpx; height: 140rpx; line-height: 140rpx; text-align: center Silver {background-color: silver;}. Gold {background-color: gold;}. Blue {background-color: blue;}. Brown {background-color: brown;}. Inner-circle {position: absolute; margin-top: 70rpx; margin-left: 70rpx; width: 140rpx; height: 140rpx; line-height: 140rpx; text-align: center; border-radius: 100%; background-color: lightblue;}. Rotate {display: inline-block; transform: rotate (- 45deg);}
Note: if the text area is not inline-block, the rotation attribute will not take effect!
Button click event
Button: function (e) {var buttonType = e.currentTarget.dataset.type console.log (buttonType) switch (buttonType) {case 'chaAdd': console.log (' backward the channel') break case 'chaDes': console.log (' forward the channel') break case 'volAdd': console.log (' strengthen the volumn') break case 'volDes': Console.log ('weaken the volumn') break default: console.log (' ok')}}
Running effect
Thank you for reading, the above is the content of "how CSS imitates remote control buttons". After the study of this article, I believe you have a deeper understanding of how CSS imitates remote control buttons, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!