Lill Lansey
Lill Lansey

Reputation: 4915

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 put 2 block style controls at the same horozontal level in a webpage. What is the best way to do this with css?

Upvotes: 0

Views: 60

Answers (4)

Upgradingdave
Upgradingdave

Reputation: 13076

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...

Upvotes: 1

simshaun
simshaun

Reputation: 21466

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.

Upvotes: 0

Ivan Ivanic
Ivan Ivanic

Reputation: 3054

.blockStyleControl {
    float: left;
}

Upvotes: 2

Andy
Andy

Reputation: 2774

display: inline;

That will have the elements render inline.

Upvotes: 0

Related Questions