We can set div with left image and button at the bottom by two methods as follows:
Method 1: Using bootstrap
Float-left
These utility classes float-left a component to the left or disable floating, based on the current viewport size utilizing the CSS float property. !important is included to dodge (avoid) specificity issues. These utilize the same viewport breakpoints as our grid system.
Position-relative
It is same as CSS property position: relative.
Position-absolute
It is same as CSS property position: absolute.
Example:
<!DOCTYPE html><htmllang="en"><head><!-- Required meta tags --><metacharset="utf-8"/><metaname="viewport"content="width=device-width,initial-scale=1,shrink-to-fit=no" /><!-- Bootstrap CSS --><linkrel="stylesheet"href=integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"crossorigin="anonymous"/><scriptsrc=crossorigin="anonymous"></script><title>Set div with left image</title><styletype="text/css">.bottom-left {left: 0;}</style></head><body><h1style="color: #006400;"><br/>GeeksforGeeks</h1><divclass="float-left"><imgsrc=height="150"/></div><divclass="position-relative"style="color: green;"><h1>Hey There..!!</h1><p><b>This is an Example..</b></p><p>Here I have used class float-left ofbootstrap to set div with left image.</p><br/></div><divclass="position-relative"><divclass="position-absolute bottom-left"><buttontype="button"class="btn btn-success">Click me!</button></div></div></body></html>Output:
Note: If your content is less then kindly place <br> tag at end of content or else button will misplace as it is position-relative to content.
Using bootstrap 3 we can set div with left image & button at the bottom and right image & button at the bottom by a bootstrap grid system too as follows:
Example:
<!DOCTYPE html><htmllang="en"><head><!-- Required meta tags --><metacharset="utf-8"/><metaname="viewport"content="width=device-width,initial-scale=1,shrink-to-fit=no" /><!-- Bootstrap CSS --><!-- Latest compiled and minified CSS --><linkrel="stylesheet"href=integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"crossorigin="anonymous"/><!-- Optional theme --><linkrel="stylesheet"href=integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp"crossorigin="anonymous"/><!-- Latest compiled and minified JavaScript --><scriptsrc=integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"crossorigin="anonymous"></script><title>Set div with left image</title><styletype="text/css">.bottom-left {left: 0;}.bottom-right {right: 0;}</style></head><body><divclass="container-fluid"><divclass="col-md-6"><divclass="pull-right"><imgsrc=height="150"/></div><divstyle="color: green; text-align: left;"><h1>Hey There..!!</h1><p><b>This is an Example..</b></p><p>Here I have used class pull-right ofbootstrap to set div with right image.</p><br/><br/></div><divclass="pull-right bottom-right"><buttontype="button"class="btn btn-success">Click me!</button></div></div><divclass="col-md-6"><divclass="pull-left"><imgsrc=height="150"/></div><divstyle="color: green;text-align: right;"><h1>Hey There..!!</h1><p><b>This is an Example..</b></p><p>Here I have used class pull-left ofbootstrap to set div with left image.</p><br/><br/></div><divclass="pull-left bottom-left"><buttontype="button"class="btn btn-success">Click me!</button></div></div></div></body></html>Output:
Note: Due to the bootstrap grid system output will look different when code will be run on IDE hence run this code on your source.
Method 2: Using Flexbox
Example:
<!DOCTYPE html><htmllang="en"><head><!-- Required meta tags --><metacharset="utf-8"/><metaname="viewport"content="width=device-width,initial-scale=1,shrink-to-fit=no" /><title>Set div with left image</title><styletype="text/css">.flex_row {display: flex;flex-direction: row;flex-wrap: nowrap;justify-content: flex-start;align-content: stretch;align-items: flex-start;}.article {box-sizing: border-box;flex: 1 1 50%;align-self: stretch;padding: 10px;}.content {box-sizing: border-box;flex: 1 1 auto;align-self: stretch;padding: 0 10px;display: flex;flex-direction: column;flex-wrap: nowrap;}.innercontent {flex: 1 1 auto;align-self: stretch;color: green;}.buttonBar {flex: 0 0 auto;}.onRight {text-align: left;}</style></head><body><h1style="color: #006400;"><br/>GeeksforGeeks</h1><divclass="flex_row"><divclass="article onRight flex_row"><divclass="image"><imgsrc=height="150"/></div><divclass="content"><divclass="innercontent"><h1>Hey There..!!</h1><p><b>This is an Example..</b></p><p>Here I have used Flexbox modelto set div with left imageand button at bottom.</p><br/></div><divclass="buttonBar"><button>Click me!</button></div></div></div></div></body></html>Output:


