自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

解決CSS margin-top在火狐下失效問題

開發(fā) 前端
這里向大家描述一下CSS margin-top在火狐下失效的解決方法,margin-top屬性在火狐及IE下面的表現(xiàn)有的時(shí)候是不一樣的,在火狐下面可以實(shí)現(xiàn)自己定義的效果但是到了IE下面卻成了雙倍的像素。

margin-top屬性在火狐及IE下面的表現(xiàn)有的時(shí)候是不一樣的,這里和大家分享一下CSS margin-top在火狐下失效的方法,在火狐下margin-top很多時(shí)候都會(huì)失效,解決這個(gè)問題的辦法就是在CSS里面加入:float:left;display:inline;請(qǐng)看下文詳細(xì)介紹。

解決CSS margin-top在火狐下失效的方法

margin-top屬性在火狐及IE下面的表現(xiàn)有的時(shí)候是不一樣的,在火狐下面可以實(shí)現(xiàn)自己定義的效果但是到了IE下面卻成了雙倍的像素,在火狐下margin-top很多時(shí)候都會(huì)失效,解決這個(gè)問題的辦法就是在CSS里面加入:float:left;display:inline;

例子:

  1. <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"  
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  3. <htmlxmlnshtmlxmlns="http://www.w3.org/1999/xhtml"> 
  4. <head> 
  5. <metahttp-equivmetahttp-equiv="Content-Type"
  6. content="text/html;charset=gb2312"/> 
  7. <title>無標(biāo)題文檔</title> 
  8. <styletypestyletype="text/CSS"> 
  9. <!--  
  10. .w{  
  11. background-color:#000099;  
  12. padding:0px;  
  13. height:100px;  
  14. width:200px;  
  15. margin-top:20px;  
  16. margin-left:30px;  
  17. }  
  18. --> 
  19. </style> 
  20. </head> 
  21. <body> 
  22. <divstyledivstyle="background-color:#006666;
  23. width:400px;height:200px;clear:both;"> 
  24. <divclassdivclass="w"></div> 
  25. </div> 
  26. </body> 
  27. </html> 
  28.  

 解決后:

  1. <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"  
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  3. <htmlxmlnshtmlxmlns="http://www.w3.org/1999/xhtml"> 
  4. <head> 
  5.  
  6. <metahttp-equivmetahttp-equiv="Content-Type"
  7. content="text/html;charset=gb2312"/> 
  8. <title>無標(biāo)題文檔</title> 
  9. <styletypestyletype="text/CSS"> 
  10. <!--  
  11. .w{  
  12. background-color:#000099;  
  13. padding:0px;  
  14. height:100px;  
  15. width:200px;  
  16. margin-top:20px;  
  17. margin-left:30px;  
  18. float:left;display:inline;  
  19. }  
  20. --> 
  21. </style> 
  22. </head> 
  23. <body> 
  24. <divstyledivstyle="background-color:#006666;
  25. width:400px;height:200px;clear:both;"> 
  26. <divclassdivclass="w"></div> 
  27. </div> 
  28. </body> 
  29. </html> 
  30.  

 原文出處:http://hi.baidu.com/yimeng3025/modify/blog/5267ce3095970211eac4af16

【編輯推薦】

  1. Chroma屬性實(shí)現(xiàn)CSS濾鏡透明效果
  2. CSS Sprites圖片切割術(shù)與圖片優(yōu)化
  3. CSS中DIV彈出層問題解決方案
  4. CSS規(guī)范化命名通用命名規(guī)則
  5. CSS分欄布局的兩種方法:絕對(duì)定位和浮動(dòng)
責(zé)任編輯:佚名 來源: hi.baidu.com
相關(guān)推薦

2010-09-13 17:15:59

margin-top

2010-08-26 13:54:33

Firefoxmargin-top

2010-08-31 09:19:46

margin-topFirefox

2010-08-31 09:13:00

margin-top

2010-08-25 10:46:53

margin-topCSS

2010-08-31 09:06:25

Firefox margin-top

2010-08-25 09:48:25

CSSmargin

2010-08-25 10:05:03

margin-top

2010-08-30 16:53:14

FirefoxIE8margin-top

2010-09-02 15:18:42

CSSASP.NET

2010-08-26 14:00:28

CSSmargin

2010-08-26 12:59:29

marginCSS

2010-08-25 11:23:31

IE6margin

2010-08-20 13:46:10

IEFirefoxCSS

2010-08-20 14:27:23

IE火狐CSS

2010-09-15 11:26:05

IE火狐CSS兼容性

2023-03-06 21:43:29

token失效服務(wù)器

2010-08-26 10:08:50

CSSmargin

2010-08-25 09:30:56

marginCSS

2010-08-30 12:54:59

CSSmargin
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)