Have a nice Day,

i tried to use vertical-align property of css in one of my project, but it did not work at all. can anybody tell me how can we use this property properly or any other alternative technique.

thanks in advance

Recommended Answers

All 8 Replies

What are you trying to achive with vertical-align?

i want to set images/text in center of block.

Ok in that case it's not vertical-align you need to use. vertical-align will align an elements withing an inline-level or a tabel cell.

eg. If you wanted to align an image above or below a line of text if that image is inline with that text.

I asume you have come accross centering an image horizontialy in css? You would use the same method in vertical alignment.

#blah {
position: relative;
margin-top: auto;
margin-bottom: auto;
// Plus all the other usual ie workarounds etc.
}
.sree {
	vertical-align: text-top;
}

Yeah it's not ment to be used like that!

Do not expect to center things vertically in the browser window. It won't work on all browsers or all screen resolutions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.