首页 > Web开发 > 详细

css---过渡天坑

时间:2019-11-01 15:07:25      阅读:78      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style type="text/css">
            #test{
                width: 100px;
                height: 100px;
            
                border:3px solid red;
                background: pink;
                text-align: center;
                font: 50px/200px "微软雅黑" ;
                
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                top: 0;
                margin: auto;
                transition-property: width;
                transition-duration: 9s;
                 transition-timing-function: inherit;
                
            }
            html{
                height: 100%;
            }
            html body{
                  height: 60%;
                  border: 3px solid yellow;
                  margin-top: 100px;
                 
            }
            body:hover #test{
                transition-property: height;    
                width: 200px;
                height: 200px;
            
            }
            
        </style>
    </head>
    <body>
        <div id="test">
        
        </div>
    </body>
</html>

异步加载                                       确实没看懂这什么坑

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style type="text/css">
            #test{
                width: 10px;
                height: 10px;
            
                border:3px solid red;
                background: pink;
                text-align: center;
                font: 50px/200px "微软雅黑" ;
                
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                top: 0;
                margin: auto;
                transition-property: width;
                transition-duration: 9s;
                 transition-timing-function: inherit;
                
            }
            html{
                height: 100%;
            }
            html body{
                  height: 60%;
                  border: 3px solid yellow;
                  margin-top: 100px;
                 
            }
         
            
        </style>
        <script type="text/javascript">
        
            //transition 在元素首次渲染还没有结束的情况下是不会触发的
            var tst=document.querySelector("#test");
            tst.style.width="300px";
        </script>
        
    </head>
    <body>
        <div id="test">
        
        </div>
    </body>
</html>
在元素首次渲染还没有结束的情况下是不会触发的

css---过渡天坑

原文:https://www.cnblogs.com/hack-ing/p/11776750.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!