<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
我想要一个显示为标准文本但在悬停时转换为标准按钮样式的按钮。
这就是我所说的 3D 按钮。换句话说,当您在 html 中创建标签时,大多数浏览器上显示的默认按钮。
我现在拥有的是:
button{
margin:5px;
background-color:white;
border:0px;
}
...
<button > Home </button>
更新:针对您的评论,从头开始生成新的 3D 背景和边框并不是我的初衷(这就是我所说的导入图像很明显的意思),但这可能会解决我的问题.听起来没有内置的方法可以在悬停时显示默认的 3D 按钮,而不生成新图像
编辑:澄清一下,我希望按钮在悬停时转到“默认样式”(如上图所示)。当没有悬停时,它应该按照上面 CSS 中的指定显示 - 换句话说就是纯文本。将任何提及的“默认 3D 按钮”替换为“标准按钮”。
最佳答案
如果您只想在按钮未悬停时应用样式,请使用否定伪类。
button:not(:hover) {
background: white;
border-color: white;
border-style: solid;
}
<button>Home</button>
关于html - 如何将标准文本标签转换为悬停按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33509628/