zoukankan      html  css  js  c++  java
  • 怎样把一个DIV放到另一个div右下角

    怎样把一个DIV放到另一个div右下角???

    借助CSS定位来实现,你将右下角的那个DIV放在另一个DIV里面,参考代码如下示:

    <div id="box1">

    <div id="box2">测试内容</div>

    </div>

    <style>

    <!--

    #box1{600px;height:600px;background:green;position:relative}

    #box1 #box2{200px;height:200px;background:red;position:absolute;right:0;bottom:0}

    -->

    </style>

    父对象相对定位,子对象以父对象为参考点绝对定位;

    外层的div设置为相对定位,内层的div设置为绝对定位;

  • 相关阅读:
    HDU 5444 Elven Postman 二叉排序树
    HDU 5438 Ponds dfs模拟
    Gym
    markdown test
    Gym
    集训回顾
    UVALive
    UVALive
    UVALive
    codeforcres 589 J
  • 原文地址:https://www.cnblogs.com/wangsaiming/p/3509221.html
Copyright © 2011-2022 走看看