Pablo
Pablo

Reputation: 29519

How to align img and h4 vertically?

Is it possible to align this using CSS, so the text will be vertically centered next to image?

<div><img class="paragraph-icon" src="images/desc.png" /><h4>Description</h4></div>

Upvotes: 0

Views: 8543

Answers (2)

Maikel
Maikel

Reputation: 367

try this:

<div style="height=IMAGE_HEIGHT; line-height:IMAGE_HEIGHT">  
    <img class="paragraph-icon" src="images/desc.png" />
    <h4 style="display: inline;">Description</h4>  
</div>`

replace IMAGE_HEIGHT with your image's height (and don't forget to add 'px;'), and that should make everything in that div centered vertically.

Upvotes: 4

Vinay B R
Vinay B R

Reputation: 8421

use this

<div>
    <img class="paragraph-icon" src="images/desc.png" style="vertical-align: middle;">
    <h4 style="display: inline;">Description</h4>
</div>

Upvotes: 0

Related Questions