【发布时间】:2015-02-27 07:18:31
【问题描述】:
问题是,网站的 CSS 在 FireFox 和 Chrome 上是不同的..
火狐按我想要的方式加载它,但在 chrome 中它搞砸了......
我也尝试将其添加到 CSS 中,
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
我使用的是 Visual Studio 2010,所以该网站在我的本地主机上...
我尝试清除所有 cookie/缓存...
尝试使用不同的基于 Chrome 的浏览器..(SW Iron)...似乎是一样的...
这就是问题所在..
.categories ul {
margin: 0; padding: 0;
float: left;
width:100%;
}
.categories ul li {
display: inline;
float:left;
padding-top:10px;
}
.categories ul li:nth-child(1) a{
padding: 0 66.5px 10px 66.5px;
margin-left:16.375px;
}
.categories ul li:nth-child(4) a{
padding: 0 69px 10px 69px;
}
.categories ul li:nth-child(6) a:after{
display:none;
}
.categories ul li:nth-child(7) a{
margin-left:15.375px;
}
.categories ul li:nth-child(8) a{
padding: 0 51px 10px 51px;
}
.categories ul li:nth-child(10) a{
padding: 0 73px 10px 73px;
}
.categories ul li:nth-child(11) a:after{
display:none;
}
.categories ul li:nth-child(12) a{
margin-left:16.375px;
padding: 0 53px 10px 53px;
border-bottom:none;
}
.categories ul li:nth-child(13) a{
padding: 0 53px 10px 53px;
border-bottom:none;
}
.categories ul li:nth-child(14) a{
border-bottom:none;
}
.categories ul li:nth-child(15) a{
padding: 0 53px 10px 53px;
border-bottom:none;
}
.categories ul li:nth-child(16) a{
border-bottom:none;
}
.categories ul li:nth-child(17) a:after{
display:none;
}
.categories ul li:nth-child(17) a{
border-bottom:none;
}
.categories ul li a {
position : relative;
float: left;
text-decoration: none;
color: white;
padding-bottom:10px;
padding-left:40px;
padding-right: 40px;
border-bottom: 2px solid #e5e5e5;
}
.categories ul li a:after {
position: absolute;
right: 0;
content: '';
height: 100%;
width: 1px;
background: linear-gradient(to top, black, transparent);
}
.categories ul li a:hover, .categories ul li .current
{
background: -moz-linear-gradient(top, rgba(0,0,0,0) 1%, rgba(255,255,255,0.12) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,rgba(0,0,0,0)), color-stop(100%,rgba(255,255,255,0.12))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 1%,rgba(255,255,255,0.12) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(0,0,0,0) 1%,rgba(255,255,255,0.12) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(0,0,0,0) 1%,rgba(255,255,255,0.12) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(0,0,0,0) 1%,rgba(255,255,255,0.12) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#1fffffff',GradientType=0 ); /* IE6-9 */
}
.categories ul li a:visited {
color: white;
}
Firefox 图片在顶部.... Chrome 在底部...
【问题讨论】:
-
如果这就是您想要的外观,那么您在 CSS 上做得太过火了。这可以用更少的钱来实现。
-
将其添加为第一个样式:
* { box-sizing: border-box; margin: 0; padding: 0; },然后从那里开始样式化。 -
@slime,好吧,我按照我知道的方式做到了:/ abhitalks 我尝试了您提供的代码,但没有任何改变...?
-
那么在这种情况下,您必须为您的问题创建一个 MCVE:stackoverflow.com/help/mcve
标签: css google-chrome firefox alignment padding