Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to put image in css 'box'

Status
Not open for further replies.

dwcasey

MIS
Oct 31, 2002
179
US
I would like to put an image in the lower corner of this css 'box' i've made.

Is this something I put in the html file as part of the div class statement or should it go in the .css file where the div is defined?

 
it can go in either

but the way you do it depends on the situation.

the simplest way is to set the image as a background for your box and fix it to the bottom right.

Code:
#myBox {
    background:url(path/to/myImage.jpg) bottom right no-repeat;
}

This may not be suitable though if, for instance you want the user to interact with the image (i.e. make it a hyperlink)

- Web design and ranting
- Day of Defeat gaming community
"I'm making time
 
Something like this:

<div class="oneThird" style="background-color: rgb(250,240,230) background:url(path/to/myImage.jpg) bottom right no-repeat;">

I already had the color in there, forgot to mention that.
 
Code:
<div class="oneThird" style="background:url(path/to/myImage.jpg) bottom right no-repeat rgb(250,240,230);">

That should work too. You can specify the color in the same style definition.

try it and see if it works.

- Web design and ranting
- Day of Defeat gaming community
"I'm making time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top