venkat
venkat

Reputation: 131

Placing the table on div

<div id="container">

<div class="main_div">

  <div class="cell1">1</div>
  <div class="cell2">2</div>

    <table>
     <tr>

       <td > The Tag </td>
        <td> The  Tag </td>
             .....
          more data
      </tr>

     </table>
</div>
</div>

</body>
</html>

Here the Table won't fit the container when I try to do. How can achieve to fit the table in "container tag? any idea?

css

#container{
margin:0 auto;
width:640px;
}

Table 
  width:900px;

/* how to fit shall I reduce the container to table width */ or no solution? My container has the left and right side gap & when I include the table it look odd and not fit the container box ?

Upvotes: 1

Views: 637

Answers (2)

Gordon Gustafson
Gordon Gustafson

Reputation: 41259

You can't have the table that's 900px fit in a container that's 640px. It's best to declare the width in one of them and have the other take on that width:

#container { width: 900px; }
table { width: 100%; }

Upvotes: 1

fearofawhackplanet
fearofawhackplanet

Reputation: 53466

huh? Why are you making the table bigger than the container if you want it to fit inside the container?

Try:

table
{
    width:100%;
}

If that's not what you meant, you need to be more clear with your question because I'm really not understanding your thought process here.

Upvotes: 1

Related Questions