網頁布局DIV+CSS,在IE中能顯示置中的,在Firefox上不能顯示置中,偏左怎麼解決

來源:互聯網
上載者:User

網頁布局DIV+CSS,在IE中能顯示置中的,在Firefox上不能顯示置中,偏左

 

style="margin-left:auto;margin-right:auto;width:640px;"

 

第一次用firefox測試時,也許你會發現在
IE下正常置中顯示的架構無法置中顯示,而且怎麼調都不行,很讓人頭痛......ME TOO,-
-!我們在IE下一般用的置中方法是:text-aglin:center;
在firefox下是沒效果的。在firefox下置中的辦法就
是:style{margin:0 auto}

=>style{margin:0 auto},auto我們把它理解為“自動”或者是“隨便多少”,但我認為理解為“自動延伸”更合適,就是說當你設定好其中一邊或者多邊的時候,剩下的自動延伸。這樣理解就可以想象為什麼firefox下的位置是怎麼定的了。。。

比如:

置中margin:0 auto
居左 margin:0 auto 0 0
居右 margin:0 0 0 auto

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.