user user - 7 months ago 23
HTML Question

using a div inside a td tag

i want a code which displays as

Account No:
enter image description here

But in my code its displayed asenter image description here

and my code is as below

<td colspan="3">Account No:<div class="boxed">

</div>
<div class="boxed">

</div>
<div class="boxed">

</div>
<div class="boxed">

</div>
<div class="boxed">

</div>
</td>

Answer

Enclose the Account No. text with a div and add

CSS "float:left"

To that div.

Working code:

<table>
<tr>
    <td colspan="3" style="float: left;">
        <div style="float: left">Account No:</div>
        <div class="boxed"></div>
        <div class="boxed"></div>
        <div class="boxed"></div>
        <div class="boxed"></div>
        <div class="boxed"></div>
    </td>
</tr>
</table>
<style>
.boxed {
    border: 1px solid;
    width: 50px;
    height: 50px;
    float: left;
}
</style>
Comments