登录  /  注册

CSS3实现的player播放按钮_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 11:59:15
原创
1374人浏览过

完成的效果如下

 

查看效果并下载

 

Step 1:先了解border的原理:

 

 

Step 2:HTML代码结构

 

Html代码   

  1.   
  2.    
  3.   
  4.     Start  
  5.   
  6.   
  7.    
  8.   
  9.     Pause  
  10.   
  11.   
  12.    
  13.   
  14.     Stop  
  15.   
  16.   
  17.    
  18.   
  19.     Forward  
  20.     Forward  
  21.   
  22.   
  23.    
  24.   
  25.     Rewind  
  26.     Rewind  
  27.   
  28.   
  29.   
  30.   
  31.     Eject  
  32.     Eject  
  33.   
  34.   
  35.   

 

 

Step 3:画背景圆,position:relative

 

 

Css代码   

  1. .playContainer li { position: relative; float: left; border: 25px solid #404040; color: #404040; height: 0; width:0; -webkit-border-radius: 100%; -moz-border-radius: 100%; -o-border-radius: 100%; border-radius: 100%; margin: 0 20px; }  

 

 

 

 

Step 4:画stop按钮,要让按钮居中。

 

按钮相对外层圆圈绝对定位,从圆圈的中心开始,所以要调整top和left值

 

stop按钮边长14px,相对原点需要向上、向左移动7个像素,居中。

 

全部的CSS如下:

 

 

Css代码   

    1.    .playContainer { position: relative; float: left; background: rgba(0, 0, 0, 0.8); padding: 20px; }  
    2. .playContainer li { position: relative; float: left; border: 25px solid #404040; color: #404040; height: 0; width:0; -webkit-border-radius: 100%; -moz-border-radius: 100%; -o-border-radius: 100%; border-radius: 100%; margin: 0 20px; }  
    3. .playContainer a { border-style: solid; text-indent: -9999px; position: absolute; top: -8px; left: -3px;  }  
    4.   
    5. .playBtn a { border-color: transparent transparent transparent #fff; border-width: 8px 0 8px 12px;  width: 0; height: 0; }  
    6. .pauseBtn a { border-color: transparent white;  border-width: 0 6px; height: 15px; width: 6px; left: -9px; }  
    7. .stopBtn a { border: 7px solid #fff; height: 0; width: 0; left: -7px; top: -7px;}  
    8. .forwardBtn a { border-left-width: 8px; left: 1px; }  
    9. .forwardBtn a:first-child { margin-left: -7px;  }  
    10.   
    11. .rewindBtn a { border-width: 8px 8px 8px 0; border-color: transparent #fff transparent transparent; width: 0; height: 0; }  
    12. .rewindBtn a:first-child { margin-left: -7px; }  
    13.   
    14. .ejectBtn a.arrow { border-width: 0 8px 8px 8px; border-color: transparent transparent #fff transparent; top:-26px; left:-8px; }  
    15. ectBtn a.dash { border-width: 0 0 4px; border-color: transparent transparent #fff; height: 0; width:16px; left: -8px; top: 4px; } 

智能AI问答
PHP中文网智能助手能迅速回答你的编程问题,提供实时的代码和解决方案,帮助你解决各种难题。不仅如此,它还能提供编程资源和学习指导,帮助你快速提升编程技能。无论你是初学者还是专业人士,AI智能助手都能成为你的可靠助手,助力你在编程领域取得更大的成就。
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
关于CSS思维导图的课件在哪? 课件
凡人来自于2024-04-16 10:10:18
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号