如何删除 HTML 按钮上的灰色'边框”
P粉986028039
P粉986028039 2024-03-30 10:30:48
0
1
414

我在 HTML 网页上看到按钮周围有边框。我正在尝试将一个按钮设为蓝色和一个绿色,并将它们放在桌子上。代码如下:

<table align="center">
  <tr style=" font-family: verdana; font-size: 24px;">
    <th> Select your Region </th>
  </tr>
  <tr>
  </tr>
  <tr>
  </tr>
  <tr>
  </tr>
  <tr>
  </tr>
  <tr>
    <td align="center">
      <button>
            <a id="cust" type="button" 
            style=
            "background-color: #00824A;
              border: none;
              color: white;
              padding: 16px 55px;
              text-align: center;
              text-decoration: none;
              display: inline-block;
              font-size: 16px;
              margin: 4px 2px;
              transition-duration: 0.4s;
              cursor: pointer;
              font-weight: bold;
              font-family: verdana"
            href="URL">
            US
            </a>
            </button>
    </td>
  </tr>
  <tr>
  </tr>
  <tr>
  </tr>
  <tr>
  </tr>
  <tr>
  </tr>
  <tr>
    <td align="center">
      <button>
            <a id="cust" type="button" 
            style=
            "background-color: #0061D5;
              border: none;
              color: white;
              padding: 16px 55px;
              text-align: center;
              text-decoration: none;
              display: inline-block;
              font-size: 16px;
              margin: 4px 2px;
              transition-duration: 0.4s;
              cursor: pointer;
              font-weight: bold;
              font-family: verdana" 
            href="URL">
            EU
            </a>
            </button>
    </td>
  </tr>
</table>

这是它们在网页上的显示方式:

我希望整个按钮都是那种颜色,周围没有灰色。我删除了样式中带有 border: none 的“边框”。相反,它在较大的灰色按钮内显示一个颜色矩形。

P粉986028039
P粉986028039

全部回复(1)
P粉605233764

边框是 button 元素本身,而不是其中的链接 。您需要使用

设置按钮样式并删除默认边框

相关阅读:https://css-tricks.com/overriding-default -按钮样式/


Select your Region
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!