codingbiz
codingbiz

Reputation: 26386

Style not working on this table

I have neglected this for awhile now just to focus on the working part. But now am more concerned about this part and it's not going away

<table cellspacing="0" cellpadding="0" style="border:none">
    <tr>
            <td class="editor-label" width="140px">
                @Html.LabelFor(model => model.UserName)
            </td>
            <td class="editor-field">
                @Html.DisplayFor(model => model.UserName)
            </td>
    </tr>
    ....

</table>

As you can see I put removed cellpadding, cellspacing, added border=none and none of this fixed it. Why is this table no responding to css?

The rows lines are not going away. I want to remove the lines.

I have also remove all class attributes on the td but this didn't still work

UPDATE

I removed this in the Style.css and it worked. But why couldn't I use inline style to override the style sheet settings?

table td {
    padding: 5px;
    border: solid 1px #e8eef4;
}

For now I will just have my own style. Why was the assumption that every table must have lines?

Upvotes: 0

Views: 10505

Answers (2)

user1519537
user1519537

Reputation:

Something in your CSS is setting the border attribute on your tds or the border-collapse attribute on table. Without a paste of your CSS and HTML somewhere, it's difficult to say for sure where the problem is.

If you'd rather dodge the CSS file, you can set CSS inline. Try some of these:

<table style="border-collapse: collapse !important; border-spacing: 0 !important;">

or

<td style="border: 0 !important;">

The !important keyword will over-ride anything set in an external stylesheet.

Upvotes: 4

Harry
Harry

Reputation: 1699

it would be

style="border:none;"

if anything - with the semi-colon.

To remove the borders

table{
      border-collapse: collapse;
      border-spacing: 0;
}

Upvotes: 0

Related Questions