How to align content of a div to the bottom

后端 未结 26 2903
挽巷
挽巷 2020-11-22 01:13

Say I have the following CSS and HTML code:

26条回答
  •  一个人的身影
    2020-11-22 02:05

    A perfect cross-browser example is probably this one here:

    http://www.csszengarden.com/?cssfile=/213/213.css&page=0

    The idea is both to display the div at the bottom and also making it stick there. Often the simple approach will make the sticky div scroll up with the main content.

    Following is a fully working minimal example. Note that there's no div embedding trickery required. The many BRs are just to force a scrollbar to appear:

    
    
    
        
    
    
    
    
        















































    If you are wondering your code might not be working on IE, remember to add the DOCTYPE tag at the top. It's crucial for this to work on IE. Also, this should be the first tag and nothing should appear above it.

提交回复
热议问题