<?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/171/c2</link>
        <lastBuildDate>Sat, 11 Feb 2012 03:31:13 +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>難以發現的 CSS 問題</title>
            <link>http://waterlily-lsl.com/modules/article/view.article.php/171/c2</link>
            <description><![CDATA[類別: 語言集<br />來源: (池水間)話說昨天在Opera瀏覽器下為池水間進行網站優化和代碼改良時，間隔了一段長時間才去打開firefox檢視一下網站，這下不看猶自可，一看嚇了一跳，在firefox下的池水間變得面目全非，馬上打開其他瀏覽器查看，結果safari也是和firefox一樣有問題，只有opera和IE都正常，這是怎麼回事了？<br /><br />從firefox和safari出現的徵狀來看，似乎是瀏覽器在解析CSS語法上出問題，打開CSS查看了語法，來回檢查了好幾遍，偏偏就沒有找到錯漏之處，連CSS檔的編碼也是正確的utf8。正當百思不得其解之際，我的視線不經意地落在頁腳左邊W3C的CSS驗證連結上，頓時靈光一閃，利用這驗證工具查看，在W3C驗證結果頁面下的CSS立時現形。<br /><br />CSS有什麼問題？給出以下例子：<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 Strict//EN&quot; &quot;&#104;ttp:&#47;&#47;&#119;ww.w3.org/TR/xhtml1/DTD/xhtml1-strict&#46;dtd&quot;&gt;
&lt;html xmlns=&quot;<a href="http://www.w3.org/1999/xhtml&quot;" title="http://www.w3.org/1999/xhtml&quot;" rel="external">http://www.w3.org/1999/xhtml&quot;</a> xml:lang=&quot;zh-tw&quot; lang=&quot;zh-tw&quot;&gt;
&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;style type=&quot;text/css&quot;&gt;
 /*&lt;![CDATA[*/
<span style="color: #ffac00;">.example1 {    font-size:20px;    color:#1dab5c;    }
.example2 {　　font-size:12px;　　color:#ff0000;　　}</span>
 /*]]&gt;*/
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p class=&quot;example1&quot;&gt;字體較大，為綠色字&lt;/p&gt;
&lt;p class=&quot;example2&quot;&gt;字體較小，為紅色字&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></div><br />從上面的橘色CSS語法中，能看出哪裡有錯誤的地方嗎？如果給個提示，只有 .example2 的那一行語法顯示出來不正常，那麼又能不能看出錯誤在哪裡？<br /><br />請分別在firefox和IE下，各<a href="javascript:void(0); " onclick="javascript:openpppTool()">點按這裡</a>，將上面語法複製進實驗板去觀看結果。<br /><br />這是一般人用肉眼也不易發現得到的問題，這也是我近來才發現這個鮮為人知郤又存在的問題。好在利用W3C驗證工具，CSS就無所遁形：<br /><div style="background:url(/uploads/article/images/0904061.gif) no-repeat 50% 0;width:900px;height:238px"></div><br />沒錯，圖中的紅框就是CSS裡面的空格，會以亂碼呈現，就是出在這些空格是用全形，正常的空格應該是用半形的。<br /><br />依照上面的錯誤頁面上的行數提示，逐一把空格找出來修正，再把CSS送去W3C驗證，最後熟悉的綠標題背景頁面終於再度呈現回來了。<br /><div style="background:url(/uploads/article/images/0904062.gif) no-repeat 50% 0;width:900px;height:363px"></div><br />]]></description>
            <author>睡蓮</author>
            <pubDate>Mon, 06 Apr 2009 13:44:40 +0200</pubDate>
        </item>
    </channel>
</rss>

