Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
190
rated 0 times [  194] [ 4]  / answers: 1 / hits: 21246  / 12 Years ago, wed, september 5, 2012, 12:00:00

I've got an image which I want to use inline with some text, but I need it to match the text height. I know it's possible to something like <img src=img.jpg height=16> or even <img src=img.jpg height=100%>, but the former does not scale with text size and the latter seems to make it the size of the div, not the text height. Can anyone help?



Example HTML:



<body>
This is a test <img src=img.jpg>
</body>

More From » html

 Answers
2

Did you try this giving the image height as 1em?



img {height: 1em;}


Check out the fiddle here: http://jsfiddle.net/yAr7z/


[#83231] Tuesday, September 4, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
janeth

Total Points: 498
Total Questions: 91
Total Answers: 89

Location: Malaysia
Member since Wed, May 11, 2022
2 Years ago
;