Display Img and Div inline - it's not rendered inline

Posted by user359372 on Stack Overflow See other posts from Stack Overflow or by user359372
Published on 2010-06-05T19:34:58Z Indexed on 2010/06/05 19:42 UTC
Read the original article Hit count: 346

Filed under:
|
|
|
|

In order to follow correct web standards, I've tried to layout image and div inline. In orde to achieve that - I've used display:inline property. But then I experienced the following issue: image renders from the center line, and div doesn't respect height parameter set to it. I've tried using line-height parameter, but that didn't give any useful results. I've also tried various combinations with setting margin/padding to some values or to auto, or replacing div with span, or wrapping img and div with additional divs. I've managed to achieve desired result by using position:absolute, but that doesn't help in cases where I want to use centered/relative positioning of the whole component...

Any clues or ideas or troubleshooting hints?

Please find the html example below:

Test Page
Some text that should be displayed in the center/middle of the div



123   Some text that should be displayed in the center/middle of the div

© Stack Overflow or respective owner

Related posts about html

Related posts about div