How can I put 2 block style controls at the same horizontal level in a webpage with css?
I have been using an html table to p开发者_Python百科ut 2 block style controls at the same horozontal level in a webpage. What is the best way to do this with css?
.blockStyleControl {
float: left;
}
Perhaps you can floating the elements would do the trick?
html:
<div id="block1">Block 1</div>
<div id="block2">Block 2</div>
css:
#block1 {
float: left;
}
...of course, this is just a demonstration example...you'd probably want to use a css class instead of hard coding id's...
display: inline;
That will have the elements render inline.
There are several ways.
The most cross-browser compatible methods are to either float them, position them absolutely, or display inline or inline-block.
The less cross-browser compatible method is to use display: table-cell
.
精彩评论