Tornado
Tornado

Reputation: 127

aligning a table on left doesn't work by CSS, but works by HTML

I have a weird problem with a when I want to change an inline style for a table to a style defined in CSS. My goal is to align this table to the left of the page.

Aligns correctly to the left: HTML:

<table class="box-table" style="margin-left: 0px">
<tr>
     <td>table content</td>
</tr>
</table>

CSS:

table.box-table
{
    width: auto;
    text-align: left;
}

Doesn't align to the left (aligns to the center of the page) HTML:

<table class="box-table">
<tr>
     <td>table content</td>
</tr>
</table>

CSS:

table.box-table
{
    width: auto;
    text-align: left;
    margin-left: 0px;
}

The only change I did was moving the margin-left -property from the HTML- to the CSS-code. Any idea why tis happens?

Upvotes: 1

Views: 203

Answers (1)

Tornado
Tornado

Reputation: 127

Problem was that this class was declared 2 times in my CSS, which had conflicting values about the margin-left -property.

Upvotes: 1

Related Questions