Björn Schönrock Björn Schönrock - 2 years ago 63
HTML Question

Contents of table are not aligned left

I want the

to be aligned left, but they aren't.

My code:

<div class="body" id="block">
<span style="width:95%;background-color: rgb(247,247,247);border-radius:10px;display:block;">
<tr style="height:25px;">
<td style="width:70%;margin-left:10px;font-size:20px;text-align:left;display:block;">
<img style="height:20px;" src="">
<td style="font-size:12px;">
Another test
<td style="width:5%;">
<td style="width:15%;font-size:12px;">
Third test

I've tried several things, but still does not work.
I don't understand what I'm doing wrong here.

Answer Source

Remove CSS display:block of <td> tag:

<td style="width:70%;margin-left:10px;font-size:20px;text-align:left;display:block;">

New code:

<td style="width:70%;margin-left:10px;font-size:20px;text-align:left;">

By default, <td> in table has CSS: display: table-cell;

True answer:

 table { width: 100%; }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download