隐藏桌子的边框

时间:2017-08-05 05:14:00

标签: html css html-table

我的UI部分始终显示边框。我怎么能隐藏它?

<div style="float:left; width:100%; height:40px; padding:25px 10px; text-align: left;">
  <div style="padding-left: 260px;">
    <table width="80%" border="0">
      <tr>
        <td width="35%">
          <b>Equipment Type</b>
          <span style="color:red"> *</span> &nbsp;&nbsp; @Html.DropDownListFor(model => model.ClassId, Model.ObjectClasses, "--Select--", new { id = "ddlObjectClass", @onchange = "ClassonChangefunc()", @style = "width:180px" })
        </td>
        <td width="5%"></td>
        <td width="30%">
          <b>Country</b>
          <span style="color:red"> *</span>&nbsp;&nbsp; @Html.DropDownListFor(model => model.CountryId, Model.CountryList, new { data_val = "false", id = "ddlCountry", name = "ddlCountry", @onchange = "CountryChangefunc()", style = "width:200px;" })
        </td>
      </tr>
    </table>
  </div>
  <div>
  </div>
</div>

但边界线仍显示......

enter image description here

隐藏边框的简单方法是什么?

2 个答案:

答案 0 :(得分:1)

为此特定表,其行和单元格添加此样式,即为此表设置ID(例如id="table),然后为此表设置样式。

#table,
#table > tbody > tr,
#table > tbody > tr > td {
  border: 0;
}

答案 1 :(得分:1)

您可以更改表格的边框样式

table, th, td, tr {
    border-style: none; //!important -> if needed
}

看一下表格(html)&amp;边境(css)

https://www.w3schools.com/html/html_tables.asp

https://www.w3schools.com/css/css_border.asp