开发者

How can I put 2 block style controls at the same horizontal level in a webpage with css?

开发者 https://www.devze.com 2023-01-31 07:21 出处:网络
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 {

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消