posts - 17, comments - 4, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          2007年9月21日

          大家都知道連續(xù)的英文或數(shù)字能是容器被撐大,不能根據(jù)容器的大小自動換行,下面是 CSS如何將他們換行的方法!

          對于div

          1.(IE瀏覽器)white-space:normal; word-break:break-all;這里前者是遵循標(biāo)準(zhǔn)。

          #wrap{white-space:normal; width:200px; }或者#wrap{word-break:break-all;width:200px;}eg.<div id="wrap">ddd1111111111111111111111111111111111</div>

          效果:可以實現(xiàn)換行

          2.(Firefox瀏覽器)white-space:normal; word-break:break-all;overflow:hidden;同樣的FF下也沒有很好的實現(xiàn)方法,只能隱藏或者加滾動條,當(dāng)然不加滾動條效果更好!

          #wrap{white-space:normal; width:200px; overflow:auto;}或者#wrap{word-break:break-all;width:200px; overflow:auto; }eg.<div id="wrap">ddd1111111111111111111111111111111111111111</div>

          效果:容器正常,內(nèi)容隱藏

          對于table

          1. (IE瀏覽器)使用樣式table-layout:fixed;
          eg.

          <style>.tb{table-layout:fixed}</style><table class="tbl" width="80"><tr><td>abcdefghigklmnopqrstuvwxyz 1234567890</td></tr></table>

          效果:可以換行

          2.(IE瀏覽器)使用樣式table-layout:fixed與nowrap
          eg.

          <style>.tb {table-layout:fixed}</style><table class="tb" width="80"><tr><td nowrap>abcdefghigklmnopqrstuvwxyz 1234567890</td></tr></table>

          效果:可以換行

          3. (IE瀏覽器)在使用百分比固定td大小情況下使用樣式table-layout:fixed與nowrap

          <style>.tb{table-layout:fixed}</style><table class="tb" width=80><tr><td width=25% nowrap>abcdefghigklmnopqrstuvwxyz 1234567890</td><td nowrap>abcdefghigklmnopqrstuvwxyz 1234567890</td></tr></table>

          效果:兩個td均正常換行

          3.(Firefox瀏覽器)在使用百分比固定td大小情況下使用樣式table-layout:fixed與nowrap,并且使用div
          eg.

          <style>.tb {table-layout:fixed}.td {overflow:hidden;}</style><table class=tb width=80><tr><td width=25% class=td nowrap><div>abcdefghigklmnopqrstuvwxyz 1234567890</div></td><td class=td nowrap><div>abcdefghigklmnopqrstuvwxyz 1234567890</div></td></tr></table>

          這里單元格寬度一定要用百分比定義

          效果:正常顯示,但不能換行(注:在FF下還沒有能使容器內(nèi)容換行的好方法,只能用overflow將多出的內(nèi)容隱藏,以免影響整體效果)

          posted @ 2007-11-07 13:57 愚人 閱讀(279) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-10-10 11:02 愚人 閱讀(249) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-10-09 13:04 愚人 閱讀(227) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-10-09 12:54 愚人 閱讀(7013) | 評論 (1)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-10-09 12:03 愚人 閱讀(839) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-10-09 11:25 愚人 閱讀(402) | 評論 (0)編輯 收藏

               摘要: 經(jīng)常會遇到一個問題——圖片自適應(yīng),以前的解決方法主要是利用js來實現(xiàn),其實也可以試試css的expression功能  閱讀全文

          posted @ 2007-09-21 09:40 愚人 閱讀(909) | 評論 (1)編輯 收藏

          主站蜘蛛池模板: 凤城市| 德庆县| 宜昌市| 黑水县| 应城市| 桐柏县| 天津市| 尚义县| 临沭县| 钦州市| 遵义县| 葫芦岛市| 乌海市| 肥西县| 乌兰察布市| 道孚县| 博罗县| 宣恩县| 宣城市| 固安县| 铜川市| 南漳县| 河曲县| 永川市| 东山县| 安平县| 广东省| 北宁市| 蕲春县| 敦煌市| 安庆市| 江北区| 宁安市| 清水县| 牡丹江市| 民权县| 邹城市| 乃东县| 台南市| 秀山| 社会|