Following is my div in which i am trying to create a square in a div , the problem i faced is that when ever i try to create a square then square goes to new line.
Example:
My [SQUARE] Should look like this // NO linebreak But my // line automatically break [SQUARE] /* line automatically break */ look like this
Note: I cannot use float to left and right and also i tried display:inline; but it didnot work. Kindly let me know how can i create a square inline to my content
<div style="width:10px; height:10px; border:1px solid #000; background:yellow;"></div>
From what I understand this is what’s happening:
Instead of
Have you tried
display: inline-block;Also, check that the containing div is able to fit all this content in a single line.
Edit: Remember that
display: blockis the DEFAULT property for (most) elements, and this will force them on a new line. So to change this you override the default yourself by setting a customdisplay:property.For a list of them all go to: http://www.w3.org/wiki/CSS/Properties/display