We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

ES-Components
on
Medium Priority
761 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
Comment
Watch Question

Commented:
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
LZ1
Top Expert 2011

Commented:
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

Author

Commented:
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
LZ1
Top Expert 2011
Commented:
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

Author

Commented:
Thank you both for the help.

Commented:
yup i missed that, thanks LZ1
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.