【问题标题】:Round corners of table桌子的圆角
【发布时间】:2017-12-08 02:54:40
【问题描述】:

我试着在我的桌子上做圆角

这是我的代码

<table class="table" style="width: 100%;border-style: solid; border-color: #1d69b4;border-radius: 10px;">
  <tr style="background: white;">
    <th style="font-size: 18px; text-align: center;">
      <b>Hours</b><b style="margin-left: 30px;"> Monday</b>
    </th>
    <th style="font-size: 20px; text-align: center;">
      <b>Hours</b><b style="margin-left: 30px;"> Tuesday</b>
    </th>
    <th style="font-size: 20px; text-align: center;">
      <b>Hours</b><b style="margin-left: 30px;"> Wednesday</b>
    </th>
    <th style="font-size: 20px; text-align: center;">
      <b>Hours</b><b style="margin-left: 30px;">  Thursday</b>
    </th>
    <th style="font-size: 20px; text-align: center;">
      <b>Hours</b><b style="margin-left: 30px;">  Friday</b>
    </th>
    <th style="font-size: 20px; text-align: center;">
      <b>Hours</b><b style="margin-left: 30px;"> Saturday</b>
    </th>
    <th style="font-size: 20px; text-align: center;">
      <b>Hours</b><b style="margin-left: 30px;"> Sunday</b>
    </th>

  </tr>
  <tr>
    <td class="title" style="text-align: center; font-size: 20px;">
      <div style="margin-top: 10px;"><b class="blue-text">08.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">09.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">10.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">11.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">12.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">13.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">14.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">15.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">16.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">17.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">18.00</b></div>
      <div style="margin-top: 10px;"><b class="blue-text">19.00</b></div>
    </td>



  </tr>
</table>

但它不起作用。

麻烦在哪里?

我怎样才能使它变圆?

编辑

我添加了整个代码 oа View 以全面了解问题。我看到边框,但没有圆角

【问题讨论】:

  • 成功了吗?
  • 那是因为你添加了&lt;/table&gt; OP 忘记写它的地方;)@SlimShady

标签: html css


【解决方案1】:

&lt;/table&gt; 不见了

<table class="table" style="width: 100%;border-style: solid; border-color: #1d69b4;border-radius: 10px;">
  <tr style="background: white">

    <th style="font-size: 18px; text-align: center;color:#1d69b4;border-style: solid; border-color: #1d69b4;border-radius: 10px;">
      <b>Hours</b><b style="margin-left: 30px;"> Monday</b>
    </th>
    <th style="font-size: 20px; text-align: center;color:#1d69b4;border-style: solid; border-color: #1d69b4;border-radius: 10px;">
      <b>Hours</b><b style="margin-left: 30px;"> Tuesday</b>
    </th>
    <th style="font-size: 20px; text-align: center;color:#1d69b4;border-style: solid; border-color: #1d69b4;border-radius: 10px;">
      <b>Hours</b><b style="margin-left: 30px;"> Wednesday</b>
    </th>
    <th style="font-size: 20px; text-align: center;color:#1d69b4;border-style: solid; border-color: #1d69b4;border-radius: 10px;">
      <b>Hours</b><b style="margin-left: 30px;">  Thursday</b>
    </th>
    <th style="font-size: 20px; text-align: center;color:#1d69b4;border-style: solid; border-color: #1d69b4;border-radius: 10px;">
      <b>Hours</b><b style="margin-left: 30px;">  Friday</b>
    </th>
    <th style="font-size: 20px; text-align: center;color:#1d69b4;border-style: solid; border-color: #1d69b4;border-radius: 10px;">
      <b>Hours</b><b style="margin-left: 30px;"> Saturday</b>
    </th>
    <th style="font-size: 20px; text-align: center;color:#1d69b4;border-style: solid; border-color: #1d69b4;border-radius: 10px;">
      <b>Hours</b><b style="margin-left: 30px;"> Sunday</b>
    </th>

  </tr>
</table>

【讨论】:

  • 如果它仍然不适合您,请发布您正在使用的所有代码。也许某处有覆盖。
  • 我对你的代码做了一个 sn-p。当你运行它时,它就像一个魅力。
  • 是的,但是当我在我的机器上运行它时,不是,IDK 为什么。
【解决方案2】:

Table 的 CSS 应使用 border-collapse: separate;

【讨论】:

    【解决方案3】:

    您只需要将边框半径属性应用于外部表格元素,而不是单个行/列

    here

    【讨论】:

      【解决方案4】:

      你的代码很完美。如果需要,运行代码 sn-p。

      <table class="table" style="width: 100%;border-style: solid; border-color: #1d69b4;border-radius: 10px;">
        <tr style="background: white;">
          <th style="font-size: 18px; text-align: center;">
            <b>Hours</b><b style="margin-left: 30px;"> Monday</b>
          </th>
          <th style="font-size: 20px; text-align: center;">
            <b>Hours</b><b style="margin-left: 30px;"> Tuesday</b>
          </th>
          <th style="font-size: 20px; text-align: center;">
            <b>Hours</b><b style="margin-left: 30px;"> Wednesday</b>
          </th>
          <th style="font-size: 20px; text-align: center;">
            <b>Hours</b><b style="margin-left: 30px;">  Thursday</b>
          </th>
          <th style="font-size: 20px; text-align: center;">
            <b>Hours</b><b style="margin-left: 30px;">  Friday</b>
          </th>
          <th style="font-size: 20px; text-align: center;">
            <b>Hours</b><b style="margin-left: 30px;"> Saturday</b>
          </th>
          <th style="font-size: 20px; text-align: center;">
            <b>Hours</b><b style="margin-left: 30px;"> Sunday</b>
          </th>
      
        </tr>
        <tr>
          <td class="title" style="text-align: center; font-size: 20px;">
            <div style="margin-top: 10px;"><b class="blue-text">08.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">09.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">10.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">11.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">12.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">13.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">14.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">15.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">16.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">17.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">18.00</b></div>
            <div style="margin-top: 10px;"><b class="blue-text">19.00</b></div>
          </td>
      
      
      
        </tr>
      </table>

      【讨论】:

      • 是的,我看到了,但是当我在我的机器上运行它时,它不起作用
      • 给我截图
      • 您使用哪种浏览器?
      • 尝试在table的CSS中添加border-collapse: collapse;
      • border-collapse: separate;
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-06-23
      • 1970-01-01
      • 2011-01-13
      • 2011-08-23
      • 2020-02-21
      • 2021-11-21
      相关资源
      最近更新 更多