Jump to content

[SOLVED] align img to bottom of div


ifubad

Recommended Posts

I'll save it for future reference. I need it to also work in IE and prefer not to use hacks. It's only a single page that needs this, I guess I may just have to be deal with using table. Why did Bill Gates named his company after his penis???

 

Thnx anyway

Link to comment
Share on other sites

You can set the position on the containing element to relative, then set the position of the element you want to be at the bottom to absolute. Then set the bottom on the absolutely positioned element to zero. If you want, you can also give the containing element a bottom padding that is equal to the height of the absolutely positioned element so that things don't drop behind it (I haven't tested the padding, but it should work).

Link to comment
Share on other sites

Ok, using position relative and then absolute to vertically align the image to the bottom of its container was really simple. Now, the other problem is that when an element is set to absolute, it automatically left align itself to its parent container, and to center it horizontally, I need to set the left property?

 

If so, now the tricky part is that if the width of each image is different, is the only way to figure out how many pixels to apply to the left property is using php? (which I already figured out the math to do that with, just trying to see if there was a more efficient way of doing this).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.