473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Image won't move to bottom of div

I have a div with an image which needs to appear in it's bottom left. I
currently have the padding top of the image set to 100%, which should
move the image to the bottom of the the div, but for some strange
reason, there is still space below the image which I can't get rid of.
I've set the image margins to 0 and it does nothing, so it's not the
margins. The stranger thing is, if I reduce the height of the enclosing
div to 326px, the space below the image is gone. Shouldn't the image
always remain at the bottom of the div no matter what, due to it's
padding-bottom setting?

<div style="background-image: url(images/homepage_03.jpg); width: 275px;
height: 345px; float: left;"><img src="images/sign_topright.gif"
alt="Making Homes Beautiful Since 1992" border="0" style="padding-top:
100%;"></div>

You can see what I'm talking about at http://www.aaron-chandler.com/,
where what's built of the page is temporarily residing. The little sign
piece at the bottom left of the house is what I was referring to above.

Thanks,
Aaron

Jul 20 '05 #1
5 11453
Els
Aaron wrote:
I have a div with an image which needs to appear in it's
bottom left. I currently have the padding top of the image
set to 100%, which should move the image to the bottom of
the the div, but for some strange reason, there is still
space below the image which I can't get rid of. I've set
the image margins to 0 and it does nothing, so it's not the
margins. The stranger thing is, if I reduce the height of
the enclosing div to 326px, the space below the image is
gone. Shouldn't the image always remain at the bottom of
the div no matter what, due to it's padding-bottom setting?
Probably the same space as underneath text, to make room for
the g, p, q, y, j... give the image display:block, and it
might just disappear.
<div style="background-image: url(images/homepage_03.jpg);
width: 275px; height: 345px; float: left;"><img
src="images/sign_topright.gif" alt="Making Homes Beautiful
Since 1992" border="0" style="padding-top: 100%;"></div>

You can see what I'm talking about at
http://www.aaron-chandler.com/, where what's built of the
page is temporarily residing. The little sign piece at the
bottom left of the house is what I was referring to above.


Haven't looked at it, but I'm almost positive it's the
display:block you need

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 20 '05 #2
Els wrote:

Probably the same space as underneath text, to make room for
the g, p, q, y, j... give the image display:block, and it
might just disappear. Haven't looked at it, but I'm almost positive it's the
display:block you need


I set the image style to display:block, but I'm getting the same
results. I've uploaded the changes also. If anyone wants to see what I'm
talking about, it's at www.aaron-chandler.com.

Thanks,
Aaron
Jul 20 '05 #3
Els
Aaron wrote:
Els wrote:
Probably the same space as underneath text, to make room
for the g, p, q, y, j... give the image display:block, and
it might just disappear.

Haven't looked at it, but I'm almost positive it's the
display:block you need


I set the image style to display:block, but I'm getting the
same results. I've uploaded the changes also. If anyone
wants to see what I'm talking about, it's at
www.aaron-chandler.com.


Change padding-top:100% to padding-top:107%.
Forget about the display:block :-)

Tested in IE6 and Firefox.

Reason: it's the padding to the top of the window, which
apparently is 7% of the div's height higher than the top of the
div. Has to do with a floating div being taken out of normal
flow or something like that. It's late.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 20 '05 #4
Els
Els wrote:
Aaron wrote:
Els wrote:
Probably the same space as underneath text, to make room
for the g, p, q, y, j... give the image display:block,
and it might just disappear.

Haven't looked at it, but I'm almost positive it's the
display:block you need


I set the image style to display:block, but I'm getting
the same results. I've uploaded the changes also. If
anyone wants to see what I'm talking about, it's at
www.aaron-chandler.com.


Change padding-top:100% to padding-top:107%.
Forget about the display:block :-)

Tested in IE6 and Firefox.

Reason: it's the padding to the top of the window, which
apparently is 7% of the div's height higher than the top of
the div. Has to do with a floating div being taken out of
normal flow or something like that. It's late.


Thinking again, I don't know if the space between the div and
the top of the window might change later, this would give a
problem with the method I just gave.

Instead, you can do give the image margin-top: 294px; which
will always be okay, as it is the margin between the top of
the image and the top of the div it is in, not the top of the
window.

Margin is between objects, padding is between the object and
it's own border. Seemed to stop at the window's ceiling
thought ;-)

hth

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 20 '05 #5
Thanks for the help, Els, that did the trick. You really seem to know
your CSS.

Aaron

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ohaya | last post by:
Hi, We've been having a problem with one particular page that has a button on it, and a "tall" image (top-to-bottom). The button calls some simple Javascript to print the frame in which the...
3
by: Listerofsmeg | last post by:
Hi all, Is this possible? I have a simple DIV with some text and an image inside. I want the text to wrap around the image, but I want the bottom of the image to sit on the bottom of the DIV. ...
6
by: CoreyMas | last post by:
Hello All, Here is what I would like to do I am creating a game program that displays a map (preferably in hexes but that is another matter) and whenever the user is over the "map" I want to...
8
by: Cardman | last post by:
I am hopeful that someone can quickly solve my image alignment issue when things are just not going right and where my attempts to solve this alignment issue have all failed. First of all take a...
9
panachepad
by: panachepad | last post by:
I arrived here from a websearch that found this thread from your archives: http://www.thescripts.com/forum/thread97805.html It helped me to understand that I am on the right track, but I still have...
8
by: Alexander Fischer | last post by:
Hello, I am writing a gallery script and use imagecreatefromjpeg and fpassthru to output images without any change to them (i.e., no thumbnail creation etc. - just deliver the image via the php...
5
by: GTi | last post by:
Q1) I have searched around after a cross browser JavaScript that can resize my popup window with a specified width and height. I want to set the width and height of the browsers document content....
3
by: benn600 | last post by:
I'm in the process of taking an old table laden, poor code design web site and updating it to a modern day, mostly standards compliant design with only CSS where possible. I'm not having trouble...
1
by: rsteph | last post by:
I bought a book to help me learn to use DirectX with windows programming. It's first trying to walk me through some basic windows programming and graphics before getting into DirectX. I'm trying to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.