Firefox和Safari边距

时间:2011-11-24 11:11:08

标签: css firefox safari margins

如何在firefox和safari中正确显示我的边距和填充?一般来说,什么是正确的黑客?

2 个答案:

答案 0 :(得分:2)

您应该使用CSS重置,这会将所有元素重置为默认值,因此将在所有浏览器中显示相同内容,包括Internet Explorer。

此处有更多信息:http://meyerweb.com/eric/tools/css/reset/

答案 1 :(得分:0)

这是我的方式,它删除并中和HTML元素的不一致的默认样式。首先我使用yui reset重置样式表:

/* RESET
---------------------------
Yahoo Reset
version: 3.3.0
build: 3167
*/
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}

然后我使用yahoo css base来声明常见HTML元素的样式:

/* BASE 
--------------------------------------
Yahoo Base
version: 3.3.0
build: 3167
*/

h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong{font-weight:bold; color:#333}abbr,acronym{border-bottom:1px dotted #000;cursor:help;}em{font-style:italic;}blockquote,ol,dl{margin:1em;}ol,dl{margin-left:2em;}ol li{list-style:decimal outside;}dl dd{margin-left:1em;}th{font-weight:bold;text-align:center;}caption{margin-bottom:.5em;text-align:center;}fieldset,table,pre{margin-bottom:1em;}
相关问题