您应该尝试重置您的 CSS
如果您不知道,每个浏览器都有自己的默认“用户代理”样式表,它用于使无样式的网站看起来更清晰。例如,大多数浏览器默认将链接设为蓝色,将访问链接设为紫色,为表格提供一定数量的边框和填充,对 H1、H2、H3 等应用可变字体大小,并为几乎所有内容设置一定数量的填充。有没有想过为什么提交按钮在每个浏览器中看起来都不一样?它限制了浏览器之间的差异
使用 CSS 重置,您可以强制每个浏览器将其所有样式重置为 null,从而减少跨浏览器差异
使用此代码:
/**
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
* http://cssreset.com
*/
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;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
一种常见的做法是将其放在另一个 CSS 文件中。