Reputation: 13
I have several DIVs that I want to place beside each other, but because they are blocking, they fall beneath each other. How can I fix this?
Upvotes: 1
Views: 492
Reputation: 29760
You can achieve this with the following code:
style="display:inline-block";
EDIT
for your edification:http://www.w3schools.com/html/html_styles.asp
Upvotes: 1
Reputation: 112917
div.i-like-snuggling {
/* don't ever leave me */
display: inline-block;
}
Upvotes: 4
Reputation: 46609
Or maybe absolute positioning is the best choice for you. We don't know what your HTML looks like!
Upvotes: 1
Reputation: 80
The best way is to use float:left, but in some cases you might use SPAN instead of DIV
Upvotes: 1
Reputation: 1112
Your best bet is to go with the css property "float"
div { float: left; width: 200px}
for example. If you don't specify a width, the browser will render a width that it feels appropriate (the width of a child element for example).
I've always found this article a good reference: http://css.maxdesign.com.au/floatutorial/introduction.htm
As suggested by other people, you can also use display:inline-block
. It kinda depends on what effect you want to achieve.
Upvotes: 0