-2

Currently I have two divs:

<div id="first">gdsgdsgsd</div><div id="second">aaaaaaa</div>

and the output is:

gdsgdsgsd
aaaaaaa

However I would like to have the output as:

gdsgdsgsdaaaaaaa

Here's a very plain fiddle for that :) http://jsfiddle.net/6oqrj9oo/1/

Do you have any advices for fixing that? Thanks

randomuser1
  • 2,655
  • 5
  • 30
  • 64

2 Answers2

3

These divs are block level elements so will appear stacked on top of eachother. Try making them inline or inline-block. Inline elements will sit side by side.

#first, #second {
    display: inline;
}

Alternatively you could float them

AJReading
  • 1,143
  • 20
  • 34
2

Use display:inline-block

div{
    display:inline-block;
}
<div id="first">gdsgdsgsd</div><div id="second">aaaaaaa</div>
Akshay
  • 13,805
  • 4
  • 42
  • 68