如何让子DIV在父DIV的低端
本文通过使用CSS控制子DIV显示在父DIV的低端,具体思路:
父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>
本文源自:翔宇亭——IT乐园(http://www.biye5u.com),转载请保留此信息!
微信搜索“优雅的代码”关注本站的公众号,或直接使用微信扫描下面二维码关注本站公众号,以获取最新内容。
个人成长离不开各位的关注,你的关注就是我继续前行的动力。
评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论