1

Please help me. I would like to have two divs on the same line, but one was move down.

<div style="height:200px;width:200px;display:inline-block;">
<div style="height:200px;width:200px;background:#000000;"></div>
</div>

<div style="height:200px;width:200px;display:inline-block;border:1px solid #000000;">
1<br>2</div>

example on jsfiddle.net

user3073240
  • 563
  • 1
  • 5
  • 9

3 Answers3

2

You need to add the same vertical-align to both of the outer divs.

vertical-align: top;

jsFiddle Demo

BTW - It's highly not advisable to use inline styles. Use out-of-line CSS file/block to make things better.

Community
  • 1
  • 1
Itay
  • 16,601
  • 2
  • 51
  • 72
2

you need to use vertical-align:top;

add the css vertical-align:top; to the <div>'s that have display:inline-block;

Example http://jsfiddle.net/9TZsy/2/

here's a great article on this: http://css-tricks.com/what-is-vertical-align/
another: http://www.impressivewebs.com/css-vertical-align/

Ghost Echo
  • 1,997
  • 4
  • 31
  • 46
1

Add float:left to both instead of display:inline-block

JSFIDDLE:

http://jsfiddle.net/9TZsy/3/

vaskort
  • 2,591
  • 2
  • 20
  • 29