• 思路及要点:

父div的位置设置成相对的,即“position: relative;”。

而子div的位置设置成绝对的,并且下边缘设为0,即“position: absolute; bottom: 0;”。

 

  • 代码:
<head>
    <title>子div在父div中置底</title>
    <style type="text/css">
        .father { width: 500px; height: 600px; position: relative; background-color: AliceBlue; }
        .child { width: 400px; height: 100px; position: absolute; bottom: 0; background-color: AntiqueWhite; }
    </style>
</head>
<body>
    <div class="father">
        <div class="child">
        </div>
    </div>
</body>
</html>

相关文章:

  • 2021-11-18
  • 2021-12-31
  • 2021-10-15
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-02
  • 2021-05-21
  • 2022-12-23
  • 2021-12-31
  • 2021-12-31
  • 2021-09-25
相关资源
相似解决方案