please show me a two column css table

2 replies
  • WEB DESIGN
  • |
Hi ,
Can someone give a code for a wide 100% two column table with that I can put a text on each column .
preferably with css.

Thanks alot.
#column #css #show #table
  • Profile picture of the author y3h
    With a table?

    <table style="width:100%;">
    <thead>
    <th>Col 1</th>
    <th>Col 2</th>
    </thead>

    <tbody>

    <td>
    <tr>1</tr>
    <tr>2</tr>
    </td>

    <td>
    <tr>1</tr>
    <tr>2</tr>
    </td>

    </tbody>
    </table>

    Without a table?

    <div class="half">Put whatever you want here</div>
    <div class="half">Put whatever you want here</div>

    <style>
    .half{width:50%;float:left;}
    </style>
    {{ DiscussionBoard.errors[10724211].message }}
  • Please use this code and save the code with .html extension to see the result.

    <html>
    <head>
    <title>Column Width 100% Width</title>
    <style>
    .table_one{
    width: 100%;
    background-color:#eeeeee;
    }
    .col_one{
    background-color:pink;
    }
    </style>
    </head>

    <body>
    <h2>In a single row is not possible to create two colum with 100% width. In a row only one colum will be with 100% width.</h2>
    <h2>Exapmle:-</h2>
    <table class="table_one" border="1">
    <tr class="col_one">
    <td colspan="2">
    row one - colum with 100%
    </td>
    </tr>
    <tr>
    <td>
    row two - colum one
    </td>

    <td>
    row two - column two
    </td>
    </tr>
    </table>

    </body>

    </html>

    Hope it helps.
    {{ DiscussionBoard.errors[10724278].message }}

Trending Topics