开发者

HTML & CSS: How I can make an image's bottom edge align with text?

开发者 https://www.devze.com 2022-12-10 10:40 出处:网络
In my HTML pages I have text with imgs. The top edge of the img is aligned with the top of the text, but I want the bottom of the img to be aligned with the text.

In my HTML pages I have text with imgs. The top edge of the img is aligned with the top of the text, but I want the bottom of the img to be aligned with the text.

How can this be done?

开发者_如何学C

UPDATE Now I see this is the default behaviour, but it doesn't happen in my page. What could possibly be wrong?


EDIT: I came back to add line breaks and decided to throw an example in, too.

You can do this with CSS's vertical-align property. Something like this:

<img src="wherever.png" style="vertical-align: text-top;" />

More information about the style is available at w3schools, where they have a neat sandbox.

0

精彩评论

暂无评论...
验证码 换一张
取 消