Jack_of_All_Trades
Jack_of_All_Trades

Reputation: 11498

How to align div horizontally in this case

How can I achieve this?

<div id="check > <div>hello</div> x3 <div> jello</div> y3 </div>

I was expecting css like following to place all item horizontal.

 #check {display:inline;}

But I get something like this:

hello
x3
jello
y3

I want something like:hello x3 jello y3

What am I missing here?

Upvotes: 1

Views: 49

Answers (3)

Samurai
Samurai

Reputation: 3729

You should use it for divs inside the container

 #check div {display: inline;}

Upvotes: 1

Rotem Harel
Rotem Harel

Reputation: 736

try

 #check div {display:inline;}

Upvotes: 1

bbill
bbill

Reputation: 2304

You have to apply the inline style to all of the divs you want on the same line.

Spans might be better suited to your purpose since that's what divs and spans are for. See here: http://jsfiddle.net/Q3Dtj/

Upvotes: 3

Related Questions