How to position a div at the bottom of its container using CSS?
Set the position of div at the bottom of its container can be done using bottom, and position property. Set position value to absolute and bottom value to zero to placed a div at the bottom of container. Position attribute can take multiple values which are listed below:
- absolute: This property is used when position of a division is relative to its parent (used in this example).
- relative: This property is used when position of a division in relative to other components on the screen.
- fixed: This property is used when position of a component to be fixed on screen irrespective of other HTML components (like a footer note).
The position property along with attributes like, left, right, top and bottom, can be used to display appropriate positioning. Example 1:
Example 2: In this example, use table to display the content at the bottom of the body. The top and bottom property is used to set the content at top and bottom position.
CSS is the foundation of webpages, is used for webpage development by styling websites and web apps.You can learn CSS from the ground up by following this CSS Tutorial and CSS Examples.
Please Login to comment...