【发布时间】:2023-03-12 12:34:01
【问题描述】:
我需要比标准浏览器渲染更炫的按钮,因为我不是设计师,所以我想我会使用现有的解决方案。所以,我去了网上找到的a button maker,它给我做了一个看起来不错的按钮。我复制了 CSS,我自己的按钮在我的浏览器中看起来不同。在 Inspect Element 上,CSS 是相同的。
他们的按钮是这样的:
它应用了以下规则:
我的按钮看起来更丑,因为它的四面都有大边框:
但是当我查看 CSS 时,应用的规则没有区别。虽然我的元素是input,但我的页面上也有“真实”按钮,它们表现出相同的行为。
我尝试使用或不使用重置 CSS 来运行我的页面,但这没有任何区别。我总是看起来很丑。
当我在小提琴中运行他们的代码时,我get the same ugly result。
这发生在同一台机器上同一浏览器的两个不同选项卡中,Firefox 29。
这里又是有问题的代码:
button {
border-top: 1px solid #bfd1ed;
background: #5987d1;
background: -webkit-gradient(linear, left top, left bottom, from(#2662c3), to(#5987d1));
background: -webkit-linear-gradient(top, #2662c3, #5987d1);
background: -moz-linear-gradient(top, #2662c3, #5987d1);
background: -ms-linear-gradient(top, #2662c3, #5987d1);
background: -o-linear-gradient(top, #2662c3, #5987d1);
padding: 5px 10px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
box-shadow: rgba(0,0,0,1) 0 1px 0;
text-shadow: rgba(0,0,0,.4) 0 1px 0;
color: #ffffff;
font-size: 14px;
font-family: Georgia, serif;
text-decoration: none;
vertical-align: middle;
}
button:hover {
border-top-color: #2662c3;
background: #2662c3;
color: #bdbdbd;
}
button:active {
border-top-color: #2662c3;
background: #2662c3;
}
body {
background-color: #555555;
}
【问题讨论】:
-
你应该检查计算部分,在那里你会发现差异