1

我在一个页面上创建了一个带有两个按钮(即链接)的页面。由于一个未知的原因,在 chrome、ff 和 ie 中的按钮之间会显示一个破折号。我试图在按钮之间留一点空间,而不是这个奇怪的破折号。下面是一些简单的示例代码来复制该问题:

<!DOCTYPE html>
<meta charset='utf-8'> 

<html>
    <head><title>Button Dashes?</title></head>
    <body>
        <div>
            <a href="http://www.google.com">
                <button>Google</button>
            </a>
            <a href="http://www.yahoo.com">
                <button>Yahoo</button>
            </a>
        </div>
    </body>
</html>

我需要做什么才能删除按钮之间的破折号?

4

3 回答 3

6

将您的代码更新为:

    <div>
        <a href="http://www.google.com"><button>Google</button></a>
        <a href="http://www.yahoo.com"><button>Yahoo</button></a>
    </div>

链接的默认样式有underlines,所以空格将只是一个下划线。这是一个例子:http: //jsfiddle.net/wCfBR/

这里有一些替代的方法来做buttons类似链接:如何创建一个像链接一样的 HTML 按钮?

于 2013-04-18T18:59:52.600 回答
2

要么在 CSS 文件中声明,要么直接在锚元素上声明,文本装饰为 none

<a href="http://www.google.com" style="text-decoration : none;">
于 2013-04-18T19:00:38.780 回答
0

在包裹按钮的锚标签上设置text-decoration: none;

于 2021-06-22T15:08:59.950 回答