Can't get inline blocks to align

Ben Pearce

Can any one explain why the ".name-wrap" div is not aligning with the image in this fiddle.

<!DOCTYPE html>
<html>

<style>

.element-wrap{
    display:block;
    background:blue
}

.name-wrap{
    display:inline-block;
    background:yellow
}

.model-name-wrap{
    display:block
}

.make-name-wrap{
    display:block
}

img{
 display:inline-block   
}

</style>

<body>  
<div  class="element-wrap">
<img  height="50" width="50" src="https://fbcdn-photos-h-a.akamaihd.net/hphotos-ak-prn1/c8.0.50.50/p50x50/1012747_10100658463725213_1269934886_s.jpg">
<div  class="name-wrap">
<div class="model-name-wrap">Honda</div>
<div  class="make-name-wrap">Civic</div>
</div>
Mr. Alien

You need to use vertical-align: middle; for img tag as well as .name-wrap

Demo

Relevant CSS which has to be modified :

.name-wrap{
    display:inline-block;
    background:yellow;
    vertical-align: middle;
}

img{
   display:inline-block;
   vertical-align: middle;        
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can't get two tabs to align as inline block elements in header

From Dev

Can't get rid of space behind images in divs as table-cells //inline-blocks

From Dev

Can't get text to align to bottom

From Dev

Windows Phone: Can't get ViewportControl to align

From Dev

Can't get CSS Menu to align properly

From Dev

Windows Phone: Can't get ViewportControl to align

From Dev

Can't get text to align to bottom

From Dev

How to vertically align inline-blocks like in Pinterest?

From Dev

Media queries, inline blocks and text-align justify

From Dev

How to vertically align inline-blocks like in Pinterest?

From Dev

can overflow: hidden; work with inline-blocks?

From Dev

can overflow: hidden; work with inline-blocks?

From Dev

Can't get Bootstrap list item contents to align vertically properly

From Dev

Can't Get Google Plus to Align With Other Social Media Buttons

From Dev

Can't Get Content of Column on Bootstrap Layout to Align to Left of Column

From Dev

Can't get JLabel with inline HTML to center with BoxLayout

From Dev

Can't get JLabel with inline HTML to center with BoxLayout

From Dev

Can't align "a" tag

From Dev

How to "left-center" align wrapped inline-blocks within a div

From Dev

How to get two HTML section blocks align in CSS?

From Dev

How to get inline-blocks to sit side-by-side?

From Dev

How to get inline-blocks to take up the whole line?

From Dev

Why don't inline-blocks wrap around floating elements?

From Dev

Intellij IDEA inline documentation doesn't highlight {@code } blocks as monospace

From Dev

Can not get this button to center align

From Dev

Can't align picture and text

From Dev

Can't align view to the right

From Dev

Can't inline Bokeh in IPython

From Dev

vertical-align doesn't work in inline-block

Related Related

  1. 1

    Can't get two tabs to align as inline block elements in header

  2. 2

    Can't get rid of space behind images in divs as table-cells //inline-blocks

  3. 3

    Can't get text to align to bottom

  4. 4

    Windows Phone: Can't get ViewportControl to align

  5. 5

    Can't get CSS Menu to align properly

  6. 6

    Windows Phone: Can't get ViewportControl to align

  7. 7

    Can't get text to align to bottom

  8. 8

    How to vertically align inline-blocks like in Pinterest?

  9. 9

    Media queries, inline blocks and text-align justify

  10. 10

    How to vertically align inline-blocks like in Pinterest?

  11. 11

    can overflow: hidden; work with inline-blocks?

  12. 12

    can overflow: hidden; work with inline-blocks?

  13. 13

    Can't get Bootstrap list item contents to align vertically properly

  14. 14

    Can't Get Google Plus to Align With Other Social Media Buttons

  15. 15

    Can't Get Content of Column on Bootstrap Layout to Align to Left of Column

  16. 16

    Can't get JLabel with inline HTML to center with BoxLayout

  17. 17

    Can't get JLabel with inline HTML to center with BoxLayout

  18. 18

    Can't align "a" tag

  19. 19

    How to "left-center" align wrapped inline-blocks within a div

  20. 20

    How to get two HTML section blocks align in CSS?

  21. 21

    How to get inline-blocks to sit side-by-side?

  22. 22

    How to get inline-blocks to take up the whole line?

  23. 23

    Why don't inline-blocks wrap around floating elements?

  24. 24

    Intellij IDEA inline documentation doesn't highlight {@code } blocks as monospace

  25. 25

    Can not get this button to center align

  26. 26

    Can't align picture and text

  27. 27

    Can't align view to the right

  28. 28

    Can't inline Bokeh in IPython

  29. 29

    vertical-align doesn't work in inline-block

HotTag

Archive