• 技术文章 >web前端 >css教程

    CSS3怎么做出关门开门效果

    php中世界最好的语言php中世界最好的语言2017-11-24 10:42:03原创2177
    今天给大家带来一段实例代码,怎么用CSS3做出关门开门的效果,需要用到的属性有border-widthborder-style等,我们一起来看一下。

    border-width:边框的宽度 thin 细的

    medium 默认的

    thick 粗的

    不常用

    数值px

    border-style:none 没有边框 = hidden(用于表格除外,用来解决表格边框冲突)

    solid 实线型

    dotted 点状

    dashed 虚线

    double 双线

    border-color:十六进制 #fff transparent 透明

    border: 1px solid #000;

    border-top: 1px solid #000;上边框

    border-top-width

    border-top-style

    border-top-color

    border-right:

    border-bottom:

    border-left:

    css3新增的属性

    border-image: 使用图片来填充边框

    border-image-source:图片的来源,路径

    border-image-slice:图片的分割方式

    border-image-width:图片的宽度

    border-image-outset:图片扩展

    border-image-repeat:图片重复

    效果实现代码:

    <!DOCTYPE html>
    <html>
             <head>
                       <meta charset="UTF-8">
                       <title></title>
                       <style type="text/css">
                                *{padding: 0;margin: 0;}
                                #box{
                                         width: 300px;
                                         height: 400px;
                                         background: url(img/05.jpg);
                                         background-size:cover;
                                         margin: 150px auto;
                                         position: relative;
                                         overflow: hidden;
                                }
                                .left{width: 100%;
                                         height: 100%;
                                         background: rgba(122,0,0,0.5);
                                         position: absolute;
                                         top: 0;
                                         left: -100%;
                                        
                                         transition: all 2s;
                                        
                                }
                                .right{
                                         width: 100%;
                                         height: 100%;
                                         background: rgba(0,0,135,0.5);
                                         position: absolute;
                                         top: 0;
                                         left: 100%;
                                         transition: all 4s;
                                }
                                #box:hover .left{
                                         left:-50%
                                }
                                #box:hover .right{
                                         left:50%
                                }
                       </style>
             </head>
             <body>
                       <div id="box">
                                <div></div>
                                <div></div>
                       </div>
             </body>
    </html>

    效果代码就是上面这些了,感兴趣的朋友可以手动操作一下,更多精彩请关注php中文网其它相关文章!

    相关阅读:

    HTML里怎么使用margin 0 auto

    html里div居中需要注意哪些

    html里的if注释怎么使用

    以上就是CSS3怎么做出关门开门效果的详细内容,更多请关注php中文网其它相关文章!

    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    专题推荐:CSS3 css 样式表
    上一篇:Css3动画属性怎么使用 下一篇:CSS3怎么做出过渡渐变效果
    PHP编程就业班

    相关文章推荐

    • 聊聊怎么使用CSS滤镜实现内凹平滑圆角效果• 神奇的CSS,实现自动补全字符串!• CSS如何进行性能优化?优化小技巧分享• 如何利用CSS来美化滑动输入条?自定义样式方法浅析• 2022年你值得了解的几个CSS新特性(收藏学习)

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网