本文通過使用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>
新聞熱點
疑難解答