user5025421
user5025421

Reputation:

structure HTML to allow 3 divs to float next to each other (without CSS)

Curious if this is still possible -- 3 divs aligned side by side horizontally, one on the left one in the middle and one on the right.

Possible to structure this for this to occur naturally without the use of CSS?

Upvotes: 2

Views: 155

Answers (4)

Yuriy Galanter
Yuriy Galanter

Reputation: 39807

Yes, this is possible:

<table>
  <tr>
    <td>
      <div>div 1</div>
    </td>
    <td>
      <div>div 2</div>
    </td>
    <td>
      <div>div 3</div>
    </td>
  </tr>
</table>

Upvotes: 0

user3915578
user3915578

Reputation: 49

You could try a <span> instead of div. I think those default to display:inline-block.

Upvotes: 0

The Head Rush
The Head Rush

Reputation: 3356

No. The default display value for <div> is display: block. Elements with block display cannot appear on the same line.

Upvotes: 1

Sir Neuman
Sir Neuman

Reputation: 1425

Not really doable without CSS. The easiest way to handle a scenario is to wrap the three divs in a container, then use display: inline-block on the three divs.

Upvotes: 0

Related Questions