需要使用CSS适当地调整元素位置以保持一致性。 需要添加 CSS reset 样式表来规范各个浏览器的默认样式表。以下是一些常用的CSS reset样式:
html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}/*去掉默认边距、边框、font-weight、font-style*/
body {line-height: 1;} /* 更好的大部分字体行距 */
ol,ul {list-style:none;} /*去掉列表前面的默认符号*/
table {border-collapse:collapse;border-spacing:0;} /*表格不留缝隙*/
a{text-decoration:none;color:#000;} /*链接去掉下划线、换成蓝色*/
/* 结束CSS reset */
也可以使用normalize.css库,它是一个简洁的CSS reset库,可以为不同浏览器提供更加一致的样式表。
上一篇:不同浏览器之间的不一致性
下一篇:不同浏览器之间的SVG不一致性