Html
    Css
    Js

    
                        
* { margin: 0; padding: 0; }
    #parentNode {
      position: relative;
      width: 200px;
      height: 200px;
      margin: 0 auto;
      border: 10px solid #000;
      background-color: #f09;
    }
    #childNode {
      position: absolute;
      left: 0;
      top: 0;
      padding: 30px;
      border: 6px solid #f90;
      background-color: #0099ff;
    }
    #selectBox {
      display: inline-block;
      height: 40px;
      line-height: 40px;
      margin: 50px 0 0 100px;
      font-size: 18px;
    }

                        
↑上面代码改变,会自动显示代码结果 jQuery调用版本:1.11.3
 立即下载

Javript offset 定位

0