How can I position my div at the bottom of its container?

前端 未结 24 2478
广开言路
广开言路 2020-11-22 00:46

Given the following HTML:



        
24条回答
  •  太阳男子
    2020-11-22 01:40

    Here is an approach targeted at making an element with a known height and width (at least approximately) float to the right and stay at the bottom, while behaving as an inline element to the other elements. It is focused at the bottom-right because you can place it easily in any other corner through other methods.

    I needed to make a navigation bar which would have the actual links at the bottom right, and random sibling elements, while ensuring that the bar itself stretched properly, without disrupting the layout. I used a "shadow" element to occupy the navigation bar's links' space and added it at the end of the container's child nodes.


    
    
    filler

提交回复
热议问题