css question, please help

css question, please help

I know this is not the right place to ask for a CSS help, but it's an active good forum and my question is simple.

I just want to know why does an element take up the entire width when I set the width?

For example,

  1.     <div style="width:50px;">

  2.     
  3.     <fieldset>
  4.     <legend>test A</legend>

  5.     <table>
  6.     <tr>
  7.     <td><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </td><td>
  8.         <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </td>
  9.     </tr>
  10.     
  11.     </table>
  12.         
  13.         </fieldset>
  14.     </div>

  15.     <div style=" width:300px; float:left;">
  16.     <fieldset><legend>test2</legend>
  17.     <table>
  18.     <tr>
  19.     <td><asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> </td><td>
  20.         <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> </td>
  21.     </tr>
  22.     </table>
  23.     </fieldset>
  24.     </div>
When I check through chrome developer's tools, I can see that the second table cannot float right next to the first table or the first div, because the first div is taking up the entire place though I limited the width. I know if used float:left in the first dive, both divs will float one after the other. But I want to know why does using width is not enough to do the trick?

Can someone please explain that to me?