?
Solved

How can I place an image at the bottom corner of a DIV?

Posted on 2009-02-10
6
Medium Priority
?
741 Views
Last Modified: 2012-05-06
I have a main DIV acting as the body are of my website.  Within that, I have a DIV containing my varying site content elements (light grey) and a DIV for our product search (dark grey).  At the moment, the height of the main DIV is dictated by the content DIV, with the search DIV staying at its size next to the content.

What I'd like to do is have a picture show up in the bottom right corner of the body of my site, as seen in the "goal" image, so no matter how big my content for a page gets, the image always shows down at the bottom right corner.

Is this possible, and if so, how do I go about it?
Code for the page elements with the search options stripped out to keep it concise.
 
<div id="SITEBODY">
<div id="CONTENT">
</div>
<div id="SEARCH">
<div id="SEARCHBOX">
</div>
</div>
</div>
 
CSS for the page elements
 
#SITEBODY {
overflow: auto;
width: 100%;
background-color: #4b4b4b;
margin: 0px;
padding: 0px;
float: left;
}
 
#CONTENT {
overflow: auto;
width: 675px;
float: left;
background-color:#666666;
}
 
#SEARCH {
overflow: auto;
width: 225px;
float:left;
}
 
#SEARCHBOX {
width: 195px;
float: left;
padding: 15px;
}

Open in new window

current.jpg
goal.jpg
0
Comment
Question by:ES-Components
  • 2
  • 2
  • 2
6 Comments
 
LVL 11

Accepted Solution

by:
glumlun earned 1200 total points
ID: 23605298
Hullo

Use a background image for the div you want the image to appear in. And set it's position:

background-image: url();
background-position: bottom right;

To get the padding shown in the image. Add the padding to the right and bottom of the image itself.
0
 
LVL 30

Expert Comment

by:LZ1
ID: 23605388
You could also use a div inside of the searchbox like this:
 

**DIV code**
<div id="searchbox_image">image image</div>
 
**CSS**
#searchbox_image {
	position:relative;
	width:auto;
	height:auto;
	bottom: 0px;
	float: right;
}

Open in new window

0
 

Author Comment

by:ES-Components
ID: 23611285
Thanks for the input guys.

GLUMLUN:
When I follow your method, the image repeats and fills the entire background of the DIV.

LZ1:
When I follow your method, I'm not able to get the image where I want vertically because of how the DIVS end up.  In the attached image, the green box is my "SITEBODY" DIV, the red box is my "CONTENT" DIV and the blue box is my "SEARCH" DIV.  Whether I add the image DIV to my "SEARCH" or "SEARCHBOX" DIVs, all that happens is the area that is the blue box expands slightly, but it still never runs the same length as the red box.  My "SITEBODY" DIV's height is being driven by the height of the "CONTENT" DIV's contents but the "SEARCH" DIV remains only as big as its contents.
DIVS.jpg
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Assisted Solution

by:LZ1
LZ1 earned 800 total points
ID: 23612694
This is an extension of GLUMLUN with no background repeating.

background-attachment: fixed;
	background-image: url();
	background-repeat: no-repeat;
	background-position: right bottom;
}

Open in new window

0
 

Author Closing Comment

by:ES-Components
ID: 31545286
Thank you both for the help.
0
 
LVL 11

Expert Comment

by:glumlun
ID: 23613808
yup i missed that, thanks LZ1
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question