zoukankan      html  css  js  c++  java
  • 关于阿里面试的的一个小题

    看到同学找到了阿里的这么一个面试题,感觉挺有趣,就做了做。

    用div+css做出如下效果:

    当鼠标移入带红色div上的时候,div的大小增大25%,其他的不变。如下图:

    详细代码如下:

    <!doctype html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
        <script type="text/javascript" src="js/jquery-1.12.2.js"></script>
        <script type="text/javascript">
            $(function(){
                $("div:first").hover(
                function(){
                    $(this).css({"125px",height:"125px"});
                },function(){
                    $(this).css({"100px",height:"100px"});
                });
            });
        </script>
      <style type="text/css">
         body{
            margin:0px;
            padding:0px;
         }
       
        #red{
            box-sizing:border-box;
            background-color:red;
            width:100px;
            height:100px;
            position:relative;
            z-index:11;
        }
        #green{
            box-sizing:border-box;
            background-color:green;
            width:100px;
            height:100px;
            position:absolute;
            top:100px;
            z-index:10;
        }
        #gray{
            box-sizing:border-box;
            background-color:gray;
            width:100px;
            height:200px;
            position:absolute;
            left:100px;
            top:0px;
            z-index:10;
        }

      </style>
    </head>
    <body>
            <div id="red"> </div>
            <div id="green"> </div>
            <div id="gray"> </div>
    </body>
    </html>
    复制代码
     
     
     
  • 相关阅读:
    线段树 建树 单点修改 单点/区间查询
    JAVAEE学期总结
    Spring框架教程IDEA版-----更新中
    第一章操作系统引论-------批处理、分时、实时各个操作系统特点 进程与线程的区别
    读《阿法狗围棋系统的简要分析》
    matlab启动后的默认路径
    从长辈们的故事谈起
    在成为一名老司机的路上不要狂奔
    物理学与其它科学的关系
    读《现象级带货网红的自我修养》
  • 原文地址:https://www.cnblogs.com/daimazhang/p/5370877.html
Copyright © 2011-2022 走看看