
Div’s will by default list themselves one under the other unless you apply CSS properties to them.
Here we show the best practice for placing divs on the same line.
There are two recommended methods for placing divs on one line. Floating them is the standard method. And displaying them inline is the other.
See Also: Solve the problem with the div height 100% by using simple javascript
We recommend not to use either absolute positioning or putting the divs inside a <nobr> tag. The <nobr> tag is deprecated and with absolute positioning they are stuck to a static position. We always recommend never to use absolute positioning unless it is absolute necessary.
Floating: Add something like this to your CSS:
float:left
}
Inline: Add the following property to your CSS:
display:inline
}
This should work. Further attributes may need to be added to them depending on what you want to do with them.
Note though that display:inline is not a block. you will not be able to define its width or height nor apply vertical margins/padding.




Posted in
Tags:
«






