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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vertical align

Status
Not open for further replies.

Halcrow

Programmer
Aug 24, 2004
76
GB
I have placed an image (200x roughly 130px) inside a div tag with width and height 212px. I want to align the image, using CSS, so that it sits at the bottom of the div. I've tried the vertical-align property but nothing happens. I can only get the image to sit at the top. What am I doing wrong???
 
Can you set the image to be the background of the DIV?

Code:
mydiv {
background: url(myImage.jpg) bottom right no-repeat;
}

Then set a margin or use padding to avoid other content going over the top of your image.

 
I like your idea, but the image must also be a link. I'm setting up a thumbnail gallery and want to have descriptive text below each image, all in line, and the images sitting above the text so that the bottom of each image is in line (hope that makes sense). I'm not allowed to use tables either. (The images vary in height)

There must be a way!
 
It's not an assignment - I'm new to the web developement world and inexperienced in coding. I'm setting up a web-site for someone who has some developement experience but no time! He wants me to avoid using tables wherever possible - feels that they are bad for presentation these days.
 
I can position the image horizontally using the "text-align" property. Is there no vertical alternative?
 
Halcrow said:
I can position the image horizontally using the "text-align" property.

Using the incorrect behaviour of IE please note. it will not work for strict browsers.


Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
how would align it for "strict" browsers?
 
Actually that is not true. text-align: center will center all inline elements within the parent element. Text, input boxes, images, spans. Since image is by default an inline element, text-align should work on it in every browser.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top