<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="ARTICLE @ XOOPS powered by FeedCreator" -->
<rss version="0.91">
    <channel>
        <title>睡蓮‧池水間 :: 文章</title>
        <description><![CDATA[文章XML]]></description>
        <link>http://waterlily-lsl.com/modules/article/view.article.php/165/c2</link>
        <lastBuildDate>Thu, 24 May 2012 01:21:50 +0200</lastBuildDate>
        <generator>ARTICLE @ XOOPS powered by FeedCreator</generator>
        <image>
            <url>http://waterlily-lsl.com/modules/article/images/logo.png</url>
            <title>睡蓮‧池水間 :: 文章</title>
            <link>http://waterlily-lsl.com/modules/article/</link>
            <width>92</width>
            <height>52</height>
            <description>文章XML</description>
        </image>
        <language>zh-TW</language>
        <managingEditor>waterlily at waterlily-lsl dot com</managingEditor>
        <webMaster>waterlily at waterlily-lsl dot com</webMaster>
        <category>文章</category>
        <item>
            <title>註釋在IE中造成文字溢出的研究</title>
            <link>http://waterlily-lsl.com/modules/article/view.article.php/165/c2</link>
            <description><![CDATA[類別: 語言集<br />來源: (http://www.planabc.net/2006/10/06/comment_ie_bug/)在藍色論壇看到這樣一篇帖子 <a href="http://bbs.blueidea.com/thread-1924448-1-1.html" rel="external">《IE中發現新BUG “重影”》</a>，覺得很有意思。於是在想到底是什麼原因造成的呢？便做了以下測試：<br /><br />實驗代碼如下:( <a href="javascript:void(0); " onclick="javascript:openpppTool()">按此打開實驗板</a> )<br /><div class="xoopsCode"><p class="cTitle"><img class="icon-l" src="http://waterlily-lsl.com/themes/waterlilyLSL-GW/img/code-icon1.gif" alt=""/><img class="icon-r" src="http://waterlily-lsl.com/themes/waterlilyLSL-GW/img/code-icon2.gif" alt=""/></p><pre>
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;&lt;html" title="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;&lt;html" rel="external">http://www.w3.org/TR/xhtml1/DTD/xhtml ... nal.dtd&quot;&gt;&lt;html</a> xmlns=&quot;<a href="http://www.w3.org/1999/xhtml&quot;&gt;" title="http://www.w3.org/1999/xhtml&quot;&gt;" rel="external">http://www.w3.org/1999/xhtml&quot;&gt;</a>
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
&lt;title&gt;多了一隻豬&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div style=&quot;width:400px&quot;&gt;
&lt;div style=&quot;float:left&quot;&gt;&lt;/div&gt;
&lt;!-- --&gt;
&lt;div style=&quot;float:right;width:400px&quot;&gt;↓這就是多出來的那隻豬&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></div><br />1、在 IE、Firefox 中測試，只在 IE 出現文字溢出現象。<br /><br /><strong class="A_strong">說明：</strong>註釋造成文字溢出是 IE 的 BUG 。<br /><br />2、去除 &lt;div style=”float:left”&gt;&lt;/div&gt; 中的“float:left;”，你會發現多出來的“豬”字不見了，頁面正常顯示。同樣去除 &lt;div style=”float:right;width:400px”&gt; 中的“float:right;”，多餘的“豬”字也同樣消失，頁面正常顯示。<br /><br /><strong class="A_strong">說明：</strong>註釋造成文字溢出與區塊的浮動有關。<br /><br />3、將註釋轉移到 &lt;div style=”float:left”&gt;&lt;/div&gt; 前面，多餘的“豬”字消失，頁面正常顯示。將註釋轉移到 &lt;div style=”float:right;width:400px”&gt; ↓這就是多出來的那隻豬 &lt;/div&gt; 下面，多餘的“豬”字也同樣消失，頁面正常顯示。<br /><br /><strong class="A_strong">說明：</strong>註釋造成文字溢出與其位置有關。（可與第2點結合理解）<br /><br />4、去除 &lt;div style=”float:right;width:400px”&gt; 中的“width:400px”，多餘的“豬”字消失，頁面正常顯示。<br /><br /><strong class="A_strong">說明：</strong>註釋造成文字溢出與文字區塊的固定寬度有關（無論是絕對值還是相對值）。<br /><br />5、增加註釋的條數：當1條註釋時，則多出來 1 個字；2 條註釋時，則多出來 3 個字；3 條註釋時，則多出來 5 個字……<br /><br />我們會從上面的規律中得到這樣一個公式：溢出文字的字數=註釋的條數 *2-1，這裡的字數在中文或英文數字時都成立。<br /><br />當溢出的文字字數大於文本的字數時，文字區塊將會消失。<br /><br /><strong class="A_strong">說明：</strong>溢出的字數與註釋的條數有關。<br /><br /><strong class="A_strong">由 1 和 2 的測試得知：注釋不要放置於 2 個浮動的區塊之間。</strong><br /><br /><strong class="A_strong">解決方法：</strong><br /><br />1、不放置註釋。最簡單、最快捷的解決方法，嘿嘿……<br /><br />2、註釋不要放置於 2 個浮動的區塊之間。<br /><br />3、將文字區塊包含在新的 &lt;div&gt;&lt;/div&gt; 之間，如：&lt;div style=”float:right;width:400px”&gt;&lt;div&gt; ↓這就是多出來的那隻豬 &lt;/div&gt; &lt;/div&gt;。<br /><br />4、去除文字區塊的固定寬度，與 3 有相似之處。<br /><br />可能以上的分析和解決方法有不到位或者不準確的地方，歡迎討論指正。<br />]]></description>
            <author>睡蓮</author>
            <pubDate>Sat, 21 Mar 2009 20:41:13 +0200</pubDate>
        </item>
    </channel>
</rss>

