How to Align Content of a Div to the Bottom using CSS? Last Updated : 15 Nov, 2024 Comments Improve Suggest changes Like Article Like Report Here are different ways to align the content of a div to bottom using CSS.1. Using PositioningThe positioning involves setting the parent container to position: relative and the content to position: absolute with bottom: 0, which places the content at the container's bottom edge.Syntaxposition: absolute;bottom: 0; HTML <div style="border: 1px solid green; float: left; height: 180px; margin: 2px; position: relative;"> <h2 style="text-align: center;"> A computer science portal for geeks </h2> <div style="position: absolute; bottom: 0; left: 0;"> Bottom Aligned Content Div </div> </div> Outputusing positioning2. Using FlexboxUsing Flexbox to align content to the bottom involves setting the container's display to `flex` and applying align-items: flex-end. This positions the child elements at the bottom of the container, achieving the desired alignment.Syntaxdisplay: flex;flex-direction: column; HTML <div style="display: flex; flex-direction: column; justify-content: flex-end; border: 1px solid black; height: 200px; width: 200px; padding: 10px;"> <div style="background-color: lightgreen; padding: 10px; text-align: center;"> Bottom Content </div> </div> Outputalign content of a div to the bottom using flexbox property3. Using Grid LayoutThe Grid Layout approach involves setting the container to display: grid and using align-items: end, which places the content at the bottom of the grid area, aligning it to the container's lower edge.Syntaxdisplay: grid;align-items: end; HTML <div style="display: grid; align-items: end; border: 1px solid green; height: 200px; width: 200px; padding: 10px;"> <div style="background-color: lightgreen; padding: 10px; text-align: center;"> Bottom Content </div> </div> Output 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. Comment More infoAdvertise with us K kundankumarjha Follow Improve Article Tags : Technical Scripter Web Technologies CSS Technical Scripter 2018 CSS-Misc +1 More Similar Reads How to apply !important in CSS? The !important rule in CSS is used to add more importance to a property/value than normal. It forces a style to override any other declarations, ensuring the specified property value is applied, regardless of specificity. It helps resolve conflicts but should be used sparingly to avoid complicating 2 min read How to use a not:first-child Selector in CSS? The :not(:first-child) selector in CSS targets all elements that are not the first child within their parent. It allows you to style elements except the first one, making it useful for applying styles to subsequent items in a list or layout.Syntax:not( element ) { // CSS property } Example: In this 2 min read How to Auto-Resize an Image to Fit a Div Container? To resize an image or video to fit inside a div container, use the object-fit property for precise control over how the content fits.object-fit maintains the aspect ratio or stretches the content to fill the container.Common values include cover (fills the container, may crop) and contain (fits with 3 min read How to Disable Resizable Property of Textarea using CSS? The resize property is used to disable the resizeable property of Textarea using CSS, by setting the resize property to none.Note: The resize property in CSS controls whether an element, like a textarea, can be resized by the user.Disable Resizing of TextareaThe resize property in CSS controls an el 1 min read Create an Unordered List Without Bullets using CSS To create an unordered list without bullet points, the CSS list-style-type property is used. This removes the default bullet points from the list items, and making the list appear plain.Table of ContentUsing list-style-type property Remove margin and padding after removing bullet pointsUnordered Lis 1 min read Set cellpadding and cellspacing in CSS Cell Padding The cell padding is used to define the spaces between the cells and its border. If cell padding property is not applied then it will be set as the default value. Example: html <!DOCTYPE html> <html> <head> <title>cell padding</title> <style> table, th 1 min read How to overlay one div over another div using CSS Creating an overlay effect simply means putting two div together at the same place but both the div appear when needed i.e while hovering or while clicking on one of the div to make the second one appear. Overlays are very clean and give the webpage a tidy look. It looks sophisticated and is simple 2 min read How to disable a link using only CSS? To disable a link using CSS, pointer-events can be used, which sets whether the element in the page has to respond or not while clicking on elements. The pointer-events property is used to specify whether the element should respond to pointer events or not. The following example illustrates this app 3 min read What does the â+â (plus sign) CSS selector mean? The "+" (plus sign) CSS selector, known as the adjacent sibling selector, targets the first element that immediately follows another specified element in the HTML structure. It applies styles only to the directly adjacent sibling after the selected element. Note: The IE8 and earlier versions </DO 1 min read How to Vertically Center Text with CSS? Here are three different ways to Vertically center text in CSS. Vertically center text means aligning text to appear in the middle of its container element.1. Using display PropertyWe can use display: flex to make the container as a flexbox and then applying the align-items: center to vertically cen 2 min read Like