0

firefox と safari の両方でマージンとパディングを正しく表示するにはどうすればよいですか? 一般的に言えば、適切なハックは何ですか?

4

2 に答える 2

2

CSS リセットを使用する必要があります。これにより、すべての要素がデフォルト値にリセットされ、Internet Explorer を含むすべてのブラウザーで同じように表示されます。

詳細はこちら: http://meyerweb.com/eric/tools/css/reset/

于 2011-11-24T11:12:46.183 に答える
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;}
于 2011-11-24T11:29:07.913 に答える