Turn table into div

Have this code I want to turn into div, trying to get content to display side by side, but in a div:

<table class="style1">
    <tr>
        <td class="style2">content left</td>
        <td class="style5">content right</td>
    </tr>
</table>

Answers


One way of doing it for a fluid layout is to use floating elements wrapped in a container.

<div class="style1">
    <div class="style2">Left</div>
    <div class="style5">Right</div>
</div>

Assuming a similar tag soup and a fluid layout, css as follows:

.style1 {  overflow:auto; position:relative; }
.style2 { float:left; }
.style5 { float:right; }

Or if you want them to grid together, make both elements float:left;


Ansver of Alan Kael Ball is right, But you can also use "display:table-cell"

More info about display you can find here!


Need Your Help

Spacing issue between two divs

html css css3 responsive-design

I have a spacing issue between two sibling divs in a media query. I am unable to figure out why there is spacing there. My white-green div should be touching the bottom of the arrow-box div, but fo...

Increase the number of comments in the "previously entered comments" list when committing using subclipse

eclipse svn subclipse

When I commit something using the Subclipse plugin in Eclipse, the dialog allows me to pick a previously entered comment and use its contents again for the current commit comment.