<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Badst&#039; weblog</title>
	<atom:link href="http://badst.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://badst.org</link>
	<description>刷新是一种乐趣</description>
	<lastBuildDate>Tue, 07 Feb 2012 15:33:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>有点失落</title>
		<link>http://badst.org/2012/02/%e6%9c%89%e7%82%b9%e5%a4%b1%e8%90%bd/</link>
		<comments>http://badst.org/2012/02/%e6%9c%89%e7%82%b9%e5%a4%b1%e8%90%bd/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 13:01:26 +0000</pubDate>
		<dc:creator>badst</dc:creator>
				<category><![CDATA[个人日志]]></category>

		<guid isPermaLink="false">http://badst.org/?p=338</guid>
		<description><![CDATA[跳不出那些局限，难有突破，很少创意。 编程不行，美感也不行，无法很好的掌控色彩搭配。 大都是抄别人的东西加上自己的一点点小改动。 做不出具有视觉冲击力的东西。 经常为了1px的问题试来试去，效率底下。 基础太差，系统学习很少。 肿麽办啊？？我的目标是什么？]]></description>
			<content:encoded><![CDATA[<p>跳不出那些局限，难有突破，很少创意。</p>
<p>编程不行，美感也不行，无法很好的掌控色彩搭配。</p>
<p>大都是抄别人的东西加上自己的一点点小改动。</p>
<p>做不出具有视觉冲击力的东西。</p>
<p>经常为了1px的问题试来试去，效率底下。</p>
<p>基础太差，系统学习很少。</p>
<p>肿麽办啊？？我的目标是什么？</p>
]]></content:encoded>
			<wfw:commentRss>http://badst.org/2012/02/%e6%9c%89%e7%82%b9%e5%a4%b1%e8%90%bd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Warning: Cannot modify header information</title>
		<link>http://badst.org/2012/01/warning-cannot-modify-header-information/</link>
		<comments>http://badst.org/2012/01/warning-cannot-modify-header-information/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 13:40:23 +0000</pubDate>
		<dc:creator>badst</dc:creator>
				<category><![CDATA[个人日志]]></category>
		<category><![CDATA[function.php]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Warning]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://badst.org/?p=335</guid>
		<description><![CDATA[白色主题上传上来就出问题了，编辑文章的时候出现这个错误，网上搜到很多，但都没办法解。 Warning: Cannot modify header information - headers already sent by (output started at /home/badst/domains/badst.host7.meyu.net/public_html/wp-content/themes/Spring2012/functions.php:1) in/home/badst/domains/badst.host7.meyu.net/public_html/wp-includes/pluggable.php on line 866 还有在Chrome下看到&#60;body&#62;跑到了&#60;head&#62;前面。。。我已经把所有php文件转成UTF8编码了，本来本地测试一点问题都没有的。 现在后台所有动作，修改主题什么的都会出现这个错误，虽然修改的效果已经实现。烦躁中！！！ 原因：是utf-8文件BOM头在作怪。我用的是Notepad++，保存为不含BOM头的文件，问题解决了。 &#160;]]></description>
			<content:encoded><![CDATA[<p>白色主题上传上来就出问题了，编辑文章的时候出现这个错误，网上搜到很多，但都没办法解。</p>
<p><strong>Warning</strong>: Cannot modify header information - headers already sent by (output started at /home/badst/domains/badst.host7.meyu.net/public_html/wp-content/themes/Spring2012/functions.php:1) in<strong>/home/badst/domains/badst.host7.meyu.net/public_html/wp-includes/pluggable.php</strong> on line <strong>866</strong></p>
<p>还有在Chrome下看到&lt;body&gt;跑到了&lt;head&gt;前面。。。我已经把所有php文件转成UTF8编码了，本来本地测试一点问题都没有的。</p>
<p>现在后台所有动作，修改主题什么的都会出现这个错误，虽然修改的效果已经实现。烦躁中！！！</p>
<p>原因：是utf-8文件BOM头在作怪。我用的是Notepad++，保存为不含BOM头的文件，问题解决了。</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://badst.org/2012/01/warning-cannot-modify-header-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>code, pre, blockquote, cite的不同</title>
		<link>http://badst.org/2012/01/code-pre-blockquote-cite/</link>
		<comments>http://badst.org/2012/01/code-pre-blockquote-cite/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 13:33:31 +0000</pubDate>
		<dc:creator>badst</dc:creator>
				<category><![CDATA[小技巧]]></category>
		<category><![CDATA[blockquote]]></category>
		<category><![CDATA[cite]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[pre]]></category>

		<guid isPermaLink="false">http://badst.org/?p=300</guid>
		<description><![CDATA[每个标签都是有其特定的语义的，样式上虽然可以随意变化，但语义都是无法互相替代的。 code, pre, blockquote, cite code computer code text 表示小段代码，如 font-family:Verdana,Tahoma,Arial,Sans-Serif; pre preformatted text 表示大段代码，范围更广，并且是块状元素，可能被使用来格式化各种文本，特别是代码。使用没有需要特别注意的，主要是语义上的正确使用。在WordPress的编辑器里表示为“预格式化”。如： .demo { font-family:'Conv_GoodDog-webfont',Sans-Serif; width:800px; margin:10px auto; text-align:left; border:1px solid #666; padding:10px; } blockquote 常用以大段引用，如 We hold these Truths to be self-evident, that all Men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among [...]]]></description>
			<content:encoded><![CDATA[<p>每个标签都是有其特定的语义的，样式上虽然可以随意变化，但语义都是无法互相替代的。<br />
code, pre, blockquote, cite</p>
<dl>
<dt><strong>code</strong></dt>
<dd>computer code text 表示小段代码，如</dd>
<dd><code>font-family:Verdana,Tahoma,Arial,Sans-Serif;</code></dd>
</dl>
<dl>
<dt><strong>pre</strong></dt>
<dd>preformatted text 表示<strong>大段代码</strong>，范围更广，并且是块状元素，可能被使用来格式化各种文本，特别是代码。使用没有需要特别注意的，主要是语义上的正确使用。在WordPress的编辑器里表示为“预格式化”。如：</dd>
<dd>
<pre>.demo
	{
		font-family:'Conv_GoodDog-webfont',Sans-Serif;
		width:800px;
		margin:10px auto;
		text-align:left;
		border:1px solid #666;
		padding:10px;
	}</pre>
</dd>
</dl>
<dl>
<dt><strong>blockquote</strong></dt>
<dd>常用以大段引用，如</dd>
<dd>
<blockquote class="enq"><p>We hold these Truths to be self-evident,<br />
that all Men are created equal,<br />
that they are endowed by their Creator with<br />
certain unalienable Rights,<br />
that among these are<br />
Life, Liberty and the pursuit of Happiness.</p>
<p>—The Declaration Of Independence,<br />
1776-07-04</p></blockquote>
</dd>
</dl>
<dl>
<dt><strong>cite</strong></dt>
<dd>小段行内引用</dd>
<dd>马克思名言：<cite>From each according to his ability,<br />
to each according to his need.</cite>。</dd>
</dl>
<p>也许我用blockquote+ul+li的方法表示代码是不合理的，但是怎么看行数呢？</p>
]]></content:encoded>
			<wfw:commentRss>http://badst.org/2012/01/code-pre-blockquote-cite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用SQL语句自定义sidebar的评论样式</title>
		<link>http://badst.org/2012/01/%e4%bd%bf%e7%94%a8sql%e8%af%ad%e5%8f%a5%e8%87%aa%e5%ae%9a%e4%b9%89sidebar%e7%9a%84%e8%af%84%e8%ae%ba%e6%a0%b7%e5%bc%8f/</link>
		<comments>http://badst.org/2012/01/%e4%bd%bf%e7%94%a8sql%e8%af%ad%e5%8f%a5%e8%87%aa%e5%ae%9a%e4%b9%89sidebar%e7%9a%84%e8%af%84%e8%ae%ba%e6%a0%b7%e5%bc%8f/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 01:25:41 +0000</pubDate>
		<dc:creator>badst</dc:creator>
				<category><![CDATA[小技巧]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sidebar]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://badst.org/?p=321</guid>
		<description><![CDATA[此方法仅限于不使用后台外观里的小工具拖出来的评论列表，必须自己在sidebar.php里加代码。 Code: &#60;!-- start sidecomments--&#62; &#60;li&#62; &#60;h2&#62;最新评论&#60;/h2&#62; &#60;ul class="nav-comment-content"&#62; &#60;?php global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,20) AS com_excerpt FROM $wpdb-&#62;comments LEFT OUTER JOIN $wpdb-&#62;posts ON ($wpdb-&#62;comments.comment_post_ID = $wpdb-&#62;posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC [...]]]></description>
			<content:encoded><![CDATA[<p>此方法仅限于不使用后台外观里的小工具拖出来的评论列表，必须自己在sidebar.php里加代码。</p>
<p>Code:</p>
<ol class="postcode">
<li>
<pre>&lt;!-- start sidecomments--&gt;</pre>
</li>
<li>
<pre>&lt;li&gt;</pre>
</li>
<li>
<pre>&lt;h2&gt;最新评论&lt;/h2&gt;</pre>
</li>
<li>
<pre>&lt;ul class="nav-comment-content"&gt;</pre>
</li>
<li>
<pre>&lt;?php</pre>
</li>
<li>
<pre>global $wpdb;</pre>
</li>
<li>
<pre>$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,</pre>
</li>
<li>
<pre>comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved,</pre>
</li>
<li>
<pre>comment_type,comment_author_url,</pre>
</li>
<li>
<pre>SUBSTRING(comment_content,1,20) AS com_excerpt</pre>
</li>
<li>
<pre>FROM $wpdb-&gt;comments</pre>
</li>
<li>
<pre>LEFT OUTER JOIN $wpdb-&gt;posts ON ($wpdb-&gt;comments.comment_post_ID =</pre>
</li>
<li>
<pre>$wpdb-&gt;posts.ID)</pre>
</li>
<li>
<pre>WHERE comment_approved = '1' AND comment_type = '' AND</pre>
</li>
<li>
<pre>post_password = '' ORDER</pre>
</li>
<li>
<pre>BY comment_date_gmt DESC</pre>
</li>
<li>
<pre>LIMIT 10";</pre>
</li>
<li>
<pre>$comments = $wpdb-&gt;get_results($sql);</pre>
</li>
<li>
<pre>$output = $pre_HTML;</pre>
</li>
<li>
<pre>foreach ($comments as $comment) {</pre>
</li>
<li>
<pre>$output .= "\n&lt;li class='clearfix'&gt;".get_avatar($comment-&gt;comment_author_email,$size='26')."\n&lt;div&gt;".get_comment_author_link()." : &lt;a href=\"" . get_permalink($comment-&gt;ID)."#comment-" . $comment-&gt;comment_ID . "\" title=\"on " .$comment-&gt;post_title . " ($comment-&gt;comment_author)\"&gt;" . strip_tags($comment-&gt;com_excerpt)."&lt;/a&gt;&lt;br /&gt;".$comment-&gt;comment_date_gmt."&lt;div&gt;&lt;/li&gt;";</pre>
</li>
<li>
<pre>}</pre>
</li>
<li>
<pre>$output .= $post_HTML;</pre>
</li>
<li>
<pre>echo $output;?&gt;</pre>
</li>
<li>
<pre>&lt;/ul&gt;</pre>
</li>
<li>
<pre>&lt;/li&gt;</pre>
</li>
<li>
<pre>&lt;!--end sidecomments--&gt;</pre>
</li>
</ol>
<p>表示对php以及SQL几乎一窍不通，之前用过ASP，大致看懂些尝试翻译。</p>
<p>07. 先使用sql语句拉出需要的字段，如：comment_post_ID 是评论编号等。</p>
<p>10. 使评论内容的前20个字符作为评论概要。</p>
<p>14. 找到已经被管理员许可的评论。</p>
<p>15. 而且没有被加密码</p>
<p>16. 以评论发表日期为索引，最新的在前面</p>
<p>17. 最多10个</p>
<p>18. 定义变量$comments为sql执行的所有结果</p>
<p>19. 以html格式输出</p>
<p>20. 从$comments中循环输出每个$comment</p>
<p>21. 输出的样式，这里avatar头像需要用到评论者的email，冒号""里是常量代码，代码间以点号"."连接。</p>
<p>24. 显示</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://badst.org/2012/01/%e4%bd%bf%e7%94%a8sql%e8%af%ad%e5%8f%a5%e8%87%aa%e5%ae%9a%e4%b9%89sidebar%e7%9a%84%e8%af%84%e8%ae%ba%e6%a0%b7%e5%bc%8f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3:使用background-size拉伸背景图片拉伸</title>
		<link>http://badst.org/2012/01/css3-background-size/</link>
		<comments>http://badst.org/2012/01/css3-background-size/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 01:30:27 +0000</pubDate>
		<dc:creator>badst</dc:creator>
				<category><![CDATA[小教程]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[background-size]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://badst.org/?p=304</guid>
		<description><![CDATA[记得刚接触电脑那会儿，就对windows的设置桌面背景特别感兴趣。 设置背景有3个选项：居中，平铺，拉伸。 居中就相当与css中background的：center no-repat 平铺是background的默认设置。 而拉伸这个功能终于在CSS3中千呼万唤始出来。 语法：background-size ：[ &#60;length&#62; &#124; &#60;percentage&#62; &#124; auto ]{1,2} &#124; cover &#124; contain 说明：设置背景图片大小，指定背景图片大小或百分比显示。 实例：以下这张图片，原图大小：256px * 256px CSS: color:black; height: 350px; width: 350px; padding: 20px; border: 10px dotted #111; background: #80B3FF url('http://badst.org/wp-content/uploads/2012/01/256.jpg') center no-repeat; background-size: 100%; text-shadow: 0 -1px 1px #fff; 这里是效果图，可以看到背景图片被拉伸到这个div的高度和宽度。 参考资料：http://www.zhangxinxu.com/css3/css3-background-size.php 相关属性：background-clip &#124; background-origin]]></description>
			<content:encoded><![CDATA[<p>记得刚接触电脑那会儿，就对windows的设置桌面背景特别感兴趣。</p>
<p>设置背景有3个选项：居中，平铺，拉伸。</p>
<p>居中就相当与css中background的：center no-repat</p>
<p>平铺是background的默认设置。</p>
<p>而拉伸这个功能终于在CSS3中千呼万唤始出来。</p>
<p><strong>语法：</strong><code>background-size ：[ &lt;length&gt; | &lt;percentage&gt; | auto ]{1,2} | cover | contain</code></p>
<p><strong>说明：</strong>设置背景图片大小，指定背景图片大小或百分比显示。</p>
<p><strong>实例：</strong>以下这张图片，原图大小：256px * 256px<br />
<a href="http://badst.org/wp-content/uploads/2012/01/256.jpg"><img class="alignnone size-full wp-image-306" title="256" src="http://badst.org/wp-content/uploads/2012/01/256.jpg" alt="" width="256" height="256" /></a></p>
<p><strong>CSS:</strong></p>
<pre>color:black;
height: 350px;
width: 350px;
padding: 20px;
border: 10px dotted #111;
background: #80B3FF url('http://badst.org/wp-content/uploads/2012/01/256.jpg') center no-repeat;
background-size: 100%;
text-shadow: 0 -1px 1px #fff;</pre>
<div style="color: black; height: 350px; width: 350px; padding: 20px; border: 10px dotted #111; background: #80B3FF url('http://badst.org/wp-content/uploads/2012/01/256.jpg') center no-repeat; background-size: 100%; text-shadow: 0 -1px 1px #fff;">这里是效果图，可以看到背景图片被拉伸到这个div的高度和宽度。</div>
<p>参考资料：<a target="_blank" class="external" href="http://www.zhangxinxu.com/css3/css3-background-size.php">http://www.zhangxinxu.com/css3/css3-background-size.php</a></p>
<p>相关属性：<a target="_blank" class="external" href="http://www.zhangxinxu.com/css3/css3-background-clip.php">background-clip</a> | <a target="_blank" class="external" href="http://www.zhangxinxu.com/css3/css3-background-origin.php">background-origin</a></p>
]]></content:encoded>
			<wfw:commentRss>http://badst.org/2012/01/css3-background-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>图片的另一种URL：Data URI scheme &amp; Base64</title>
		<link>http://badst.org/2012/01/%e5%9b%be%e7%89%87%e7%9a%84%e5%8f%a6%e4%b8%80%e7%a7%8durl%ef%bc%9adata-uri-scheme-base64/</link>
		<comments>http://badst.org/2012/01/%e5%9b%be%e7%89%87%e7%9a%84%e5%8f%a6%e4%b8%80%e7%a7%8durl%ef%bc%9adata-uri-scheme-base64/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 02:54:59 +0000</pubDate>
		<dc:creator>badst</dc:creator>
				<category><![CDATA[推荐阅读]]></category>
		<category><![CDATA[Base64]]></category>
		<category><![CDATA[Data URI scheme]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://badst.org/?p=295</guid>
		<description><![CDATA[在苹果的网站页面的source里看到这张图片，地址是： data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6%2BR8AAAAlElEQVR42oWQQRHEIAxF10ElVAISVgo3bCABCUhYCZWAhEpAQpoD6bzJhNnDO0DyyA8fEXkppXyVCpLViDUfyqVIQN9JFMY637hrlCySFauL21E7KVWbAIGx56rnSLqc5KPXSLo3kySalPhTygFhRDtFC09EIsMeZJSGBj7Qveh3OJW89syImiH%2BIO2BOJX0XwA2%2BQEL4pAhSX4aBQAAAABJRU5ErkJggg%3D%3D 就很奇怪这是哪里的图片？远程的？本地的？在CSDN上问人才知道这个叫Data URI scheme 网页优化的一大首要任务是减少HTTP 请求 (http request) 的次数，例如通过合并多个JS文件，合并CSS样式文件。除此之外，还有一个data URL 的密技，让我们直接把图像的内容崁入网页里面，这个密技的官方名称是 data URI scheme 。  Data URI scheme 的语法： &#60;img src="data:image/png;base64,iVBOR....&#62; 它包含一下部分： data - 取得数据的协定名称 image/png - 数据类型名称 base64 - 数据的编码方法 iVBOR.... - 编码后的数据 : , ; - data URI scheme 指定的分隔符号 &#160; Base64 编码？ 不知道什么是 base64 吗？简单地说它把一些 8-bit 数据翻译成标准 ASCII 字符，往上有很多免费的 base64 编码和解码的工具，你也可以用 [...]]]></description>
			<content:encoded><![CDATA[<p>在<a target="_blank" class="external" href="http://www.apple.com">苹果的网站页面</a>的source里看到这张图片<img class="alignnone" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6%2BR8AAAAlElEQVR42oWQQRHEIAxF10ElVAISVgo3bCABCUhYCZWAhEpAQpoD6bzJhNnDO0DyyA8fEXkppXyVCpLViDUfyqVIQN9JFMY637hrlCySFauL21E7KVWbAIGx56rnSLqc5KPXSLo3kySalPhTygFhRDtFC09EIsMeZJSGBj7Qveh3OJW89syImiH%2BIO2BOJX0XwA2%2BQEL4pAhSX4aBQAAAABJRU5ErkJggg%3D%3D" alt="" width="13" height="13" />，地址是：</p>
<pre><a target="_blank" class="external" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6%2BR8AAAAlElEQVR42oWQQRHEIAxF10ElVAISVgo3bCABCUhYCZWAhEpAQpoD6bzJhNnDO0DyyA8fEXkppXyVCpLViDUfyqVIQN9JFMY637hrlCySFauL21E7KVWbAIGx56rnSLqc5KPXSLo3kySalPhTygFhRDtFC09EIsMeZJSGBj7Qveh3OJW89syImiH%2BIO2BOJX0XwA2%2BQEL4pAhSX4aBQAAAABJRU5ErkJggg%3D%3D">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6%2BR8AAAAlElEQVR42oWQQRHEIAxF10ElVAISVgo3bCABCUhYCZWAhEpAQpoD6bzJhNnDO0DyyA8fEXkppXyVCpLViDUfyqVIQN9JFMY637hrlCySFauL21E7KVWbAIGx56rnSLqc5KPXSLo3kySalPhTygFhRDtFC09EIsMeZJSGBj7Qveh3OJW89syImiH%2BIO2BOJX0XwA2%2BQEL4pAhSX4aBQAAAABJRU5ErkJggg%3D%3D</a></pre>
<p>就很奇怪这是哪里的图片？远程的？本地的？在CSDN上问人才知道这个叫Data URI scheme</p>
<p>网页优化的一大首要任务是减少HTTP 请求 (http request) 的次数，例如通过合并多个JS文件，合并CSS样式文件。除此之外，还有一个data URL 的密技，让我们直接把图像的内容崁入网页里面，这个密技的官方名称是 data URI scheme 。</p>
<p><strong> Data URI scheme 的语法：</strong></p>
<p><code>&lt;img src="data:image/png;base64,iVBOR....&gt;</code></p>
<p>它包含一下部分：<span id="more-295"></span></p>
<p>data - 取得数据的协定名称</p>
<p>image/png - 数据类型名称</p>
<p>base64 - 数据的编码方法</p>
<p>iVBOR.... - <span style="color: #ff0000;">编码后的数据</span></p>
<p>: , ; - data URI scheme 指定的分隔符号</p>
<p>&nbsp;</p>
<p><strong>Base64 编码？</strong></p>
<p>不知道什么是 base64 吗？简单地说它把一些 8-bit 数据翻译成标准 ASCII 字符，往上有很多免费的 base64 编码和解码的工具，你也可以用 PHP 的 base64_encode() 进行编码：</p>
<p><code>&lt;?php echo base64_encode(file_get_contents('图片地址'));?&gt;</code></p>
<p>比如我用这张图片</p>
<p><a href="http://badst.org/wp-includes/images/external.png">http://badst.org/wp-includes/images/external.png</a></p>
<p>编译后获得以下字符</p>
<pre>iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAFVBMVEVmmcwzmcyZzP8AZswAZv////////9E6giVAAAAB3RSTlP///////8AGksDRgAAADhJREFUGFcly0ESAEAEA0Ei6/9P3sEcVB8kmrwFyni0bOeyyDpy9JTLEaOhQq7Ongf5FeMhHS/4AVnsAZubxDVmAAAAAElFTkSuQmCC</pre>
<p>字符前加上：data:image/png;base64,后就获得这张图片的Data URI scheme 链接，显示效果： “ <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAFVBMVEVmmcwzmcyZzP8AZswAZv////////9E6giVAAAAB3RSTlP///////8AGksDRgAAADhJREFUGFcly0ESAEAEA0Ei6/9P3sEcVB8kmrwFyni0bOeyyDpy9JTLEaOhQq7Ongf5FeMhHS/4AVnsAZubxDVmAAAAAElFTkSuQmCC" alt="" width="10" height="10" /> ”</p>
<p>因为浏览器不会缓存Data URL的图像，所以Data URL虽然节省HTTP请求，但是倘若这个图像要在网页多个地方显示的话，便会加大网页的内容，延长了下载的时间，其中一个解决办法是在一个 CSS class 中加入 data URL，在需要显示图像的区块调用这个 class，例如：</p>
<p>.logobg {<br />
background: url(data:…)<br />
}<br />
&lt;div class=”navigation logobg”&gt;..<br />
helo, hello<br />
&lt;div class=”footer logobg”&gt;…</p>
<p>&nbsp;</p>
<p>原文: <a target="_blank" class="external" href="http://sjolzy.cn/What-is-the-data-URI-scheme-and-how-to-use-the-data-URI-scheme.html">http://sjolzy.cn/What-is-the-data-URI-scheme-and-how-to-use-the-data-URI-scheme.html</a></p>
<p><img title="Wiki" src="http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png" alt="" width="135" height="155" /></p>
<p>Wiki: <a target="_blank" class="external" href="http://en.wikipedia.org/wiki/Data_URI_scheme">Data URI scheme</a> ... <a target="_blank" class="external" href="http://zh.wikipedia.org/wiki/Base64">Base64</a></p>
]]></content:encoded>
			<wfw:commentRss>http://badst.org/2012/01/%e5%9b%be%e7%89%87%e7%9a%84%e5%8f%a6%e4%b8%80%e7%a7%8durl%ef%bc%9adata-uri-scheme-base64/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2012.1 学习CSS总结和未来计划</title>
		<link>http://badst.org/2012/01/2012-1-%e5%ad%a6%e4%b9%a0css%e6%80%bb%e7%bb%93%e5%92%8c%e6%9c%aa%e6%9d%a5%e8%ae%a1%e5%88%92/</link>
		<comments>http://badst.org/2012/01/2012-1-%e5%ad%a6%e4%b9%a0css%e6%80%bb%e7%bb%93%e5%92%8c%e6%9c%aa%e6%9d%a5%e8%ae%a1%e5%88%92/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 00:58:39 +0000</pubDate>
		<dc:creator>badst</dc:creator>
				<category><![CDATA[个人日志]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[plan]]></category>
		<category><![CDATA[summary]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://badst.org/?p=119</guid>
		<description><![CDATA[总结 CSS3的各种效果太炫了，和几年前相比省了不知道多少功夫，一些简单的效果再也不要用图片了。 记得之前做的那个阳明的网站，一个透明效果搞到半死:( 有用的效果代码：（因标准不统一，各大浏览器有所不同，Firefox代码前加“-moz-”，Chrom/Safari代码前加“-webkit-” border-radius 圆角效果值越大圆的半径越大。 box-shadow 盒子阴影。可同时定义很多个，在中间以逗号分开“,”详见：CSS3属性Box-shadow text-shadow 文字阴影。详见：CSS3:文字阴影知多少 background 滑动门技术，一个图片，多个用途。通过控制背景的位置得到不同的显示结果。 CSS3里还能同时定义多个图片，以“,”分割，IE8目前都不支持这样的写法。 如果够细心，会在Google的源文件里找到这张图片。参考：[教程] 滑动门真正的魅力 父框架适应子框架的高度 这问题是学CSS+DIV的时候必须会遇到的，记得之前是在后面加clear:both，但现在流行的还是用:after .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } CSS优化 定期整理优化CSS，删除和合并不必要的代码。“对代码有洁癖的人才能写出更好的代码。”——纯引用 注意备份 进行大面积修改时一定要先做好备份，否则一旦出错，找不出来的时候追悔莫及。 &#160; &#160; 未来计划 准备做个亮色调风格 参考：http://www.css3.info/ 学习用，非剽窃！ 口号：2012的春天~ 主色调：白色，浅蓝， 主内容颜色 文字：深灰 #404040 高亮：橙色 #C60 链接：浅绿 #669517 栏位 两栏100%宽度自适应，左侧内容区宽度60em，右双侧栏 20em * 2 &#160; 感觉自己在CSS方面的功底还可以啦，弱项是javascript和原创的design能力。需要加强学习。]]></description>
			<content:encoded><![CDATA[<h3>总结</h3>
<p>CSS3的各种效果太炫了，和几年前相比省了不知道多少功夫，一些简单的效果再也不要用图片了。</p>
<p>记得之前做的那个阳明的网站，一个透明效果搞到半死:(</p>
<p><span style="text-decoration: underline;">有用的效果代码</span>：（因标准不统一，各大浏览器有所不同，Firefox代码前加“-moz-”，Chrom/Safari代码前加“-webkit-”</p>
<p><strong>border-radius</strong></p>
<p>圆角效果值越大圆的半径越大。</p>
<p><strong>box-shadow</strong></p>
<p>盒子阴影。可同时定义很多个，在中间以逗号分开“,”详见：<a title="CSS3属性Box-shadow" href="http://badst.org/2012/01/21/93">CSS3属性Box-shadow</a></p>
<p><strong>text-shadow</strong></p>
<p>文字阴影。详见：<a title="CSS3:文字阴影知多少" href="http://badst.org/2012/01/20/58">CSS3:文字阴影知多少</a></p>
<p><strong>background</strong></p>
<p>滑动门技术，一个图片，多个用途。通过控制背景的位置得到不同的显示结果。</p>
<p>CSS3里还能同时定义多个图片，以“,”分割，IE8目前都不支持这样的写法。<span id="more-119"></span></p>
<p>如果够细心，会在Google的源文件里找到<a target="_blank" class="external" href="http://www.google.com.hk/images/nav_logo101.png" target="_blank">这张图片</a>。参考：<a target="_blank" class="external" href="http://bbs.blueidea.com/thread-2959272-1-1.html">[教程] 滑动门真正的魅力</a></p>
<p><strong><a title="DIV高度自适应父DIV高度根据子DIV变化" href="http://badst.org/2012/01/16/10" target="_blank">父框架适应子框架的高度</a></strong></p>
<p>这问题是学CSS+DIV的时候必须会遇到的，记得之前是在后面加clear:both，但现在流行的还是用:after</p>
<p>.clearfix:after {<br />
content: ".";<br />
display: block;<br />
height: 0;<br />
clear: both;<br />
visibility: hidden;<br />
}</p>
<p><strong>CSS优化</strong></p>
<p>定期整理优化CSS，删除和合并不必要的代码。“对代码有洁癖的人才能写出更好的代码。”——纯引用</p>
<p><strong>注意备份</strong></p>
<p>进行大面积修改时一定要先做好备份，否则一旦出错，找不出来的时候追悔莫及。</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3>未来计划</h3>
<h4>准备做个亮色调风格</h4>
<p>参考：<a target="_blank" class="external" href="http://www.css3.info/">http://www.css3.info/</a></p>
<p>学习用，非剽窃！</p>
<p><strong>口号：2012的春天~</strong></p>
<p><strong>主色调</strong>：白色，浅蓝，</p>
<p><strong>主内容颜色</strong></p>
<p>文字：深灰 <span style="color: #404040;">#404040</span></p>
<p>高亮：橙色 <span style="color: #c60;">#C60</span></p>
<p>链接：浅绿 <span style="color: #669517;">#669517</span></p>
<p><strong>栏位</strong></p>
<p>两栏100%宽度自适应，左侧内容区宽度60em，右双侧栏 20em * 2</p>
<p>&nbsp;</p>
<p>感觉自己在CSS方面的功底还可以啦，弱项是javascript和原创的design能力。需要加强学习。</p>
]]></content:encoded>
			<wfw:commentRss>http://badst.org/2012/01/2012-1-%e5%ad%a6%e4%b9%a0css%e6%80%bb%e7%bb%93%e5%92%8c%e6%9c%aa%e6%9d%a5%e8%ae%a1%e5%88%92/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP环境搭建:Win7下安装配置Apache(2.2.21)+php(5.39)+Mysql(5.5.19)</title>
		<link>http://badst.org/2012/01/php%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%bawin7%e4%b8%8b%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%aeapache2-2-21php5-39mysql5-5-19/</link>
		<comments>http://badst.org/2012/01/php%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%bawin7%e4%b8%8b%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%aeapache2-2-21php5-39mysql5-5-19/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 14:29:38 +0000</pubDate>
		<dc:creator>badst</dc:creator>
				<category><![CDATA[技术教程]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Win7]]></category>

		<guid isPermaLink="false">http://badst.org/?p=261</guid>
		<description><![CDATA[PHP环境搭建:Win7下安装配置Apache(2.2.21)+php(5.39)+Mysql(5.5.19) 步骤一：下载 PHP 5.3 (5.3.9) VC9 x86 Thread Safe 文件名：php-5.3.9-Win32-VC9-x86.msi [38.44MB] sha1: 7c75a4c19c256b5b6d2e6dd5958402f5fd1def42 下载地址：http://windows.php.net/download/ &#160; MySQL Installer 5.5.19 文件名：mysql-installer-5.5.19.0.msi [209MB] MD5: cc20bb782c76de9f1c61507e85f88cec 下载地址：http://dev.mysql.com/downloads/installer/ &#160; Apache 2.2.21 (released 2011-09-13) httpd-2.2.21-win32-x86-openssl-0.9.8r.msi [5.56MB] 下载地址：http://httpd.apache.org/download.cgi 步骤二：安装 首相安装Apache服务，Network Domain,Server Name,email地址都可以随便写。 安装目录可以放在别的盘符，如H:/myweb 在完成apache服务的安装后，在游览器中输入http://localhost/，出现It’s work!字样，说明Apache服务安装成功了。 php建议安装在C:/php下，安装的时候会让你选择Web Server类型，这里选择Apache 2.2.x Module 然后是Apache Configuration Directory配置文件目录，默认目录是：C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf Mysql的安装，安装目录可以默认。 server type（服务器类型）选择Server Machine database usage（数据库用途）选第一个Multifunctional Database networking options 默认，Character [...]]]></description>
			<content:encoded><![CDATA[<h3>PHP环境搭建:Win7下安装配置Apache(2.2.21)+php(5.39)+Mysql(5.5.19)</h3>
<h3>步骤一：下载</h3>
<p>PHP 5.3 (5.3.9) VC9 x86 Thread Safe</p>
<p>文件名：php-5.3.9-Win32-VC9-x86.msi [38.44MB]<br />
sha1: 7c75a4c19c256b5b6d2e6dd5958402f5fd1def42</p>
<p>下载地址：<a target="_blank" class="external" href="http://windows.php.net/download/">http://windows.php.net/download/</a></p>
<p>&nbsp;</p>
<p>MySQL Installer 5.5.19</p>
<p>文件名：mysql-installer-5.5.19.0.msi [209MB]</p>
<p>MD5: cc20bb782c76de9f1c61507e85f88cec</p>
<p>下载地址：<a target="_blank" class="external" href="http://dev.mysql.com/downloads/installer/">http://dev.mysql.com/downloads/installer/</a></p>
<p>&nbsp;</p>
<p>Apache 2.2.21 (released 2011-09-13)</p>
<p>httpd-2.2.21-win32-x86-openssl-0.9.8r.msi [5.56MB]</p>
<p>下载地址：<a target="_blank" class="external" href="http://httpd.apache.org/download.cgi">http://httpd.apache.org/download.cgi</a></p>
<p><span id="more-261"></span></p>
<h3>步骤二：安装</h3>
<p>首相安装Apache服务，Network Domain,Server Name,email地址都可以随便写。</p>
<p>安装目录可以放在别的盘符，如H:/myweb</p>
<p>在完成apache服务的安装后，在游览器中输入http://localhost/，出现It’s work!字样，说明Apache服务安装成功了。</p>
<p>php建议安装在C:/php下，安装的时候会让你选择Web Server类型，这里选择Apache 2.2.x Module</p>
<p><img class="alignnone size-full wp-image-262" title="phpsetup-webserver" src="http://badst.org/wp-content/uploads/2012/01/phpsetup-webserver.png" alt="" width="509" height="398" /></p>
<p>然后是Apache Configuration Directory配置文件目录，默认目录是：C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf</p>
<p><img class="alignnone size-full wp-image-263" title="phpsetup-apacheconf" src="http://badst.org/wp-content/uploads/2012/01/phpsetup-apacheconf.png" alt="" width="509" height="398" /></p>
<p>Mysql的安装，安装目录可以默认。</p>
<p>server type（服务器类型）选择Server Machine</p>
<p>database usage（数据库用途）选第一个Multifunctional Database</p>
<p>networking options 默认，Character Set（编码）推荐UTF8通用性强</p>
<p>然后是service name和root账户密码。</p>
<h3>步骤三：配置</h3>
<p><strong>配置php</strong></p>
<p>1、打开C:/php/php.ini</p>
<p>找到<br />
; On windows:<br />
; extension_dir = "ext"<br />
修改为</p>
<p>; On windows:<br />
extension_dir = "C:/php/ext"</p>
<p>表示指定PHP扩展包的具体目录，以便调用相应的DLL文件。</p>
<p>2、由于默认PHP并不支持自动连接Mysql，需开启相应的扩展库功能，比如php_mysql.dll等，即将</p>
<p>extension=php_curl.dll<br />
extension=php_gd2.dll<br />
extension=php_mbstring.dll<br />
extension=php_mysql.dll<br />
extension=php_pdo_mysql.dll<br />
extension=php_pdo_odbc.dll<br />
extension=php_xmlrpc.dll<br />
这些extension之前的分号(;)去除。（msi安装的貌似已经去除过了）</p>
<p>3、配置PHP的Session功能</p>
<p>在使用session功能时，我们必须配置session文件在服务器上的保存目录，否则无法使用session，我们需要在Windows 7上新建一个可读写的目录文件夹，此目录最好独立于WEB主程序目录之外，此处我在D盘根目录上建立了phpsessiontmp目录，然后在php.ini配置文件中找到<br />
;session.save_path = "/tmp"<br />
修改为<br />
session.save_path = "D:/phpsessiontmp"</p>
<p>4、配置PHP的文件上传功能 如何编写PHP文件上传功能?<br />
同session一样，在使用PHP文件上传功能时，我们必须要指定一个临时文件夹以完成文件上传功能，否则文件上传功能会失败，我们仍然需要在Windows 7上建立一个可读写的目录文件夹，此处我在D盘根目录上建立了phpfileuploadtmp目录，然后在php.ini配置文件中找到<br />
;upload_tmp_dir =<br />
修改为<br />
upload_tmp_dir = "D:/phpfileuploadtmp"</p>
<p>5、修改date.timezone，否则在执行phpinfo时date部分会报错：<br />
Warning: phpinfo() [function.phpinfo]…<br />
我们需要将<br />
;date.timezone =<br />
修改为<br />
date.timezone = Asia/Shanghai</p>
<p>至此在Windows 7上php的环境配置就算完成了，但是光完成这些配置是不够的，我们需要Apache支持PHP，所以还需要在Apache配置文件中完成相应的PHP配置。</p>
<p><strong>配置Apache以支持PHP</strong></p>
<p>1、打开 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf</p>
<p>找到 #LoadModule vhost_alias_module modules/mod_vhost_alias.so 在下一行添加</p>
<p>LoadModule php5_module "c:/php/php5apache2_2.dll"<br />
PHPIniDir "c:/php"<br />
AddType application/x-httpd-php .php .html .htm</p>
<p>2、默认Apache服务器执行WEB网站目录为Apache2.2/htdocs，所以当你的WEB主程序目录变更时，我们需要修改相应的Apache配置，即将</p>
<p>DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"<br />
修改为<br />
DocumentRoot "H:/myweb"</p>
<p>&lt;Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"&gt;<br />
修改为<br />
&lt;Directory "D:/PHPWeb"&gt;</p>
<p>3、最后修改具体的index文件先后顺序，由于配置了PHP功能，当然需要index.php优先执行</p>
<p>DirectoryIndex index.html<br />
修改为<br />
DirectoryIndex index.php index.html</p>
<p>4、重启Apache服务器<br />
至此，在Apache服务器上PHP环境配置工作就完成了，你只需要在D:/PHPWeb目录下新建一个PHP文件，写入</p>
<div class="postcode">
<ol>
<li>&lt;?php</li>
<li>echo phpinfo();</li>
<li>?&gt;</li>
</ol>
</div>
<p>然后在游览器中输入http://localhost，就可以看到PHP的具体配置页面了，代表在Window 7上PHP环境配置工作就算完成了。</p>
<p>在完成Windows 7上的PHP环境配置工作后，我们需要完成PHP环境搭建的最后一步，即支持Mysql数据库。Mysql数据库的配置在安装后就完成了，现在只要做一步测试。</p>
<p>把一下代码做成php文件放到你的网站目录里然后用localhost访问</p>
<div class="postcode">
<ol>
<li>&lt;?php</li>
<li>$connect=mysql_connect("localhost","root","你的mysql密码");</li>
<li>if(!$connect) echo "Mysql Connect Error!";</li>
<li>else echo "恭喜你！Mysql已经可以连接！";</li>
<li>mysql_close();</li>
<li>?&gt;</li>
</ol>
</div>
<p>如果成功的话可以看到：恭喜你！Mysql已经可以连接！</p>
<p>Win7下如果不能使用localhost链接mysql就只能用127.0.0.1了，需要修改C:\Windows\System32\drivers\etc下的hosts文件，将</p>
<p># 127.0.0.1 localhost中的#注释去除即可。</p>
<p>到现在安装php环境全部完成，用MySQL Workbench 5.2 CE建一个空数据库然后装个wordpress吧！调试样式从此不用每次上传下载了终于！！</p>
]]></content:encoded>
			<wfw:commentRss>http://badst.org/2012/01/php%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%bawin7%e4%b8%8b%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%aeapache2-2-21php5-39mysql5-5-19/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在网页中嵌入任意字体@font-face</title>
		<link>http://badst.org/2012/01/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e5%b5%8c%e5%85%a5%e4%bb%bb%e6%84%8f%e5%ad%97%e4%bd%93font-face/</link>
		<comments>http://badst.org/2012/01/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e5%b5%8c%e5%85%a5%e4%bb%bb%e6%84%8f%e5%ad%97%e4%bd%93font-face/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 08:59:43 +0000</pubDate>
		<dc:creator>badst</dc:creator>
				<category><![CDATA[小教程]]></category>
		<category><![CDATA[@font-face]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[EOT]]></category>
		<category><![CDATA[OTF]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[TTF]]></category>
		<category><![CDATA[webfont]]></category>
		<category><![CDATA[woff]]></category>

		<guid isPermaLink="false">http://badst.org/?p=241</guid>
		<description><![CDATA[字体使用是网页设计中不可或缺的一部分。经常地，我们希望在网页中使用某一特定字体，但是该字体并非主流操作系统的内置字体，这样用户在浏览页面的 时候就有可能看不到真实的设计。美工设计师最常做的办法是把想要的文字做成图片，这样做有几个明显缺陷：1. 不可能大范围的使用该字体；2. 图片内容相对使用文字不易修改；3. 不利于网站SEO（主流搜索引擎不会将图片alt内容作为判断网页内容相关性的有效因素）。网络上有一些使用sIFR技术、或 javascript/flash hack的方法，但实现起来或繁琐，或有缺陷。下面要讲的是如何只通过CSS的@font-face属性来实现在网页中嵌入任意字体。 第一步 获取要使用字体的三种文件格式，确保能在主流浏览器中都能正常显示该字体。 .TTF，True Type Font 适用于Firefox 3.5、Safari、Opera OTF，Open Type Font 适用于Firefox 3.5、Safari、Opera .EOT，适用于Internet Explorer 4.0+ .SVG，适用于Chrome、IPhone .WOFF，适用于Firefox 3.6 +，支持Mozilla的text-rendering属性 下面要解决的是如何获取到某种字体的这三种格式文件。一般地，我们在手头上（或在设计资源站点已经找到）有该字体的某种格式文件，最常见的 是.TTF文件，我们需要通过这种文件格式转换为其余两种文件格式。字体文件格式的转换可以通过网站Font2Web，FontsQuirrel或onlinefontconverter提供的在线字体转换服务获取。这里推荐第一个站点，它允许我们选择需要的字符生成字体文件（在服务的最后一个选 项），这样就大大缩减了字体文件的大小，使得本方案更具实用性。选择一个字体文件后自动给你生成一个包含5种格式字体，一个demo.html演示，和一个字体声明文件的font.css，速度很快。 第二步 获取到这几种格式的字体文件后，下一步要在样式表中声明该字体，并在需要的地方使用该字体。 字体声明如下： @font-face { font-family: 'Conv_GoodDog-webfont'; src: url('fonts/GoodDog-webfont.eot'); src: local(''), url('fonts/GoodDog-webfont.woff') format('woff'), url('fonts/GoodDog-webfont.ttf') format('truetype'), url('fonts/GoodDog-webfont.svg') format('svg'); font-weight: normal; font-style: normal;} /*其中GoodDog-webfont替换为你的字体名称*/ 在页面中需要的地方使用该字体： .demo { font-family:'Conv_GoodDog-webfont',Sans-Serif; width:800px; [...]]]></description>
			<content:encoded><![CDATA[<p>字体使用是网页设计中不可或缺的一部分。经常地，我们希望在网页中使用某一特定字体，但是该字体并非主流操作系统的内置字体，这样用户在浏览页面的 时候就有可能看不到真实的设计。美工设计师最常做的办法是把想要的文字做成图片，这样做有几个明显缺陷：1. 不可能大范围的使用该字体；2. 图片内容相对使用文字不易修改；3. 不利于网站SEO（主流搜索引擎不会将图片alt内容作为判断网页内容相关性的有效因素）。网络上有一些使用sIFR技术、或 javascript/flash hack的方法，但实现起来或繁琐，或有缺陷。下面要讲的是如何只通过CSS的@font-face属性来实现在网页中嵌入任意字体。</p>
<p><strong>第一步</strong></p>
<p>获取要使用字体的三种文件格式，确保能在主流浏览器中都能正常显示该字体。</p>
<ul style="list-style-type: disc;">
<li>.TTF，<abbr title="TTF 扩展名的 T 图标的表示 TrueType 字体, 采用的是 TrueType 曲线, 不支持 OpenType 特性.TTF 扩展名的 O 图标的表示 OpenType - TrueType 字体, 采用的是 TrueType 曲线, 支持 OpenType 的高级特性.">True Type Font</abbr> 适用于Firefox 3.5、Safari、Opera</li>
<li>OTF，<abbr title="OTF 扩展名的 O 图标的表示 OpenType - PostScript 字体, 采用的是 PostScript 曲线, 支持 OpenType 高级特性.">Open Type Font</abbr> 适用于Firefox 3.5、Safari、Opera</li>
<li>.EOT，适用于Internet Explorer 4.0+</li>
<li>.SVG，适用于Chrome、IPhone</li>
<li>.WOFF，适用于Firefox 3.6 +，支持Mozilla的<a target="_blank" class="external" href="https://developer.mozilla.org/En/CSS/Text-rendering" target="_blank">text-rendering</a>属性</li>
</ul>
<p>下面要解决的是如何获取到某种字体的这三种格式文件。一般地，我们在手头上（或在设计资源站点已经找到）有该字体的某种格式文件，最常见的 是.TTF文件，我们需要通过这种文件格式转换为其余两种文件格式。字体文件格式的转换可以通过网站<a target="_blank" class="external" href="http://www.font2web.com/  " target="_blank">Font2Web</a>，FontsQuirrel或onlinefontconverter提供的在线字体转换服务获取。这里推荐第一个站点，它允许我们选择需要的字符生成字体文件（在服务的最后一个选 项），这样就大大缩减了字体文件的大小，使得本方案更具实用性。选择一个字体文件后自动给你生成一个包含5种格式字体，一个demo.html演示，和一个字体声明文件的font.css，速度很快。<span id="more-241"></span></p>
<p><strong>第二步</strong></p>
<p>获取到这几种格式的字体文件后，下一步要在样式表中声明该字体，并在需要的地方使用该字体。</p>
<p>字体声明如下：</p>
<div class="postcode">
<ol>
<li>@font-face {</li>
<li>font-family: 'Conv_GoodDog-webfont';</li>
<li>src: url('fonts/GoodDog-webfont.eot');</li>
<li>src: local(''),</li>
<li>url('fonts/GoodDog-webfont.woff') format('woff'),</li>
<li>url('fonts/GoodDog-webfont.ttf') format('truetype'),</li>
<li>url('fonts/GoodDog-webfont.svg') format('svg');</li>
<li>font-weight: normal;</li>
<li>font-style: normal;}</li>
<li>/*其中GoodDog-webfont替换为你的字体名称*/</li>
</ol>
</div>
<p>在页面中需要的地方使用该字体：</p>
<div class="postcode">
<ol>
<li>.demo</li>
<li>{</li>
<li>font-family:'Conv_GoodDog-webfont',Sans-Serif;</li>
<li>width:800px;</li>
<li>margin:10px auto;</li>
<li>text-align:left;</li>
<li>border:1px solid #666;</li>
<li>padding:10px;</li>
<li>}</li>
</ol>
</div>
<p>下面是我通过上面两步做的示例,请看：<strong><a title="@font-face Demo" href="/wp-content/uploads/2012/01/GoodDog-webfont/demo.html" target="_blank">@font-face Demo 演示</a></strong></p>
<div class="postcode">
<ol>
<li>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</li>
<li>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</li>
<li>&lt;head&gt;</li>
<li>&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;</li>
<li>&lt;title&gt;@font-face Demo&lt;/title&gt;</li>
<li>&lt;link rel="stylesheet" href="fonts.css" type="text/css" charset="utf-8" /&gt;</li>
<li>&lt;style type="text/css"&gt;</li>
<li>body {</li>
<li>background-color:white;</li>
<li>font-family:Verdana,Tahoma,Arial,Sans-Serif;</li>
<li>color:black;</li>
<li>font-size:12px;</li>
<li>}</li>
<li>.demo</li>
<li>{</li>
<li>font-family:'Conv_GoodDog-webfont',Sans-Serif;</li>
<li>width:800px;</li>
<li>margin:10px auto;</li>
<li>text-align:left;</li>
<li>border:1px solid #666;</li>
<li>padding:10px;</li>
<li>}</li>
<li>&lt;/style&gt;</li>
<li>&lt;/head&gt;</li>
<li>&lt;body&gt;</li>
<li>&lt;div class="demo" style="font-size:25px"&gt;</li>
<li>The quick brown fox jumps over the lazy dog.</li>
<li>&lt;/div&gt;</li>
<li>&lt;/body&gt;</li>
<li>&lt;/html&gt;</li>
</ol>
</div>
<p><strong>参考阅读：</strong></p>
<ul>
<li><a target="_blank" class="external" href="http://www.typeisbeautiful.com/2010/01/1903" target="_blank">WOFF 字体使用指南</a></li>
<li><a target="_blank" class="external" href="http://www.51action.cn/?p=70" target="_blank">在网页中嵌入任意字体</a></li>
<li><a target="_blank" class="external" href="https://developer.mozilla.org/en/CSS/@font-face" target="_blank">@font-face MDN</a></li>
<li><a target="_blank" class="external" href="http://www.alistapart.com/articles/cssatten" target="_blank">Alistapart: The Next Big Thing</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://badst.org/2012/01/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e5%b5%8c%e5%85%a5%e4%bb%bb%e6%84%8f%e5%ad%97%e4%bd%93font-face/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>检测浏览器是否支持CSS3和HTML5</title>
		<link>http://badst.org/2012/01/%e6%a3%80%e6%b5%8b%e6%b5%8f%e8%a7%88%e5%99%a8%e6%98%af%e5%90%a6%e6%94%af%e6%8c%81css3%e5%92%8chtml5/</link>
		<comments>http://badst.org/2012/01/%e6%a3%80%e6%b5%8b%e6%b5%8f%e8%a7%88%e5%99%a8%e6%98%af%e5%90%a6%e6%94%af%e6%8c%81css3%e5%92%8chtml5/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 16:21:23 +0000</pubDate>
		<dc:creator>badst</dc:creator>
				<category><![CDATA[小技巧]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://badst.org/?p=235</guid>
		<description><![CDATA[今天更新了IE9，意外的发现IE9居然都还不支持text-shadow的样式，然后就想用这个网站查查，又意外的发现用IE9和Chrome的显示情况是不一样的，原来是根据你的浏览器变化的。

这个是IE9的，一片红叉叉。

<a href="http://badst.org/wp-content/uploads/2012/01/findmebyip-ie9-css3.png"><img class="alignnone size-medium wp-image-236" title="findmebyip-ie9-css3" src="http://badst.org/wp-content/uploads/2012/01/findmebyip-ie9-css3-500x200.png" alt="" width="500" height="200" /></a>
Go this URL <a href="http://fmbip.com/" target="_blank">http://fmbip.com/</a>]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" class="external" href="http://fmbip.com/" target="_blank">http://fmbip.com/</a></p>
<p>这个网站开始应该只是为了给人查自己的IP用的，看域名就知道了，现在可以通过它知道你的以下信息：</p>
<ul>
<li><strong>Browser</strong><br />
你的浏览器和操作系统</li>
<li><strong>CSS3</strong><br />
CSS3的新增属性支持情况</li>
<li><strong>HTML5</strong><br />
HTML的新增标签 支持情况</li>
<li><strong>Forms 2.0</strong><br />
各种新增的input type，如：&lt;input type="email"&gt; ... IE9全部不支持</li>
<li><strong>CSS3 Selectors</strong><br />
CSS3新增的选择器，就像:hover, :focus, :after 这样的功能吧。:checked全不支持</li>
<li><strong>Script</strong><br />
对我来太难。。</li>
<li><strong>IP &amp; Location</strong><br />
你的IP和所在地</li>
</ul>
<p>今天更新了IE9，意外的发现IE9居然都还不支持text-shadow的样式，然后就想用这个网站查查，又意外的发现用IE9和Chrome的显示情况是不一样的，原来是根据你的浏览器变化的。</p>
<p>这个是IE9的，一片红叉叉。</p>
<p><a href="http://badst.org/wp-content/uploads/2012/01/findmebyip-ie9-css3.png"><img class="alignnone size-full wp-image-236" title="findmebyip-ie9-css3" src="http://badst.org/wp-content/uploads/2012/01/findmebyip-ie9-css3.png" alt="" width="779" height="313" /></a></p>
<p>&nbsp;</p>
<p>这个是Chrome16的，全部支持！完胜IE9</p>
<p><a href="http://badst.org/wp-content/uploads/2012/01/findmebyip-chrome16-css3.png"><img class="alignnone size-full wp-image-237" title="findmebyip-chrome16-css3" src="http://badst.org/wp-content/uploads/2012/01/findmebyip-chrome16-css3.png" alt="" width="779" height="313" /></a></p>
<p>但是似乎Chrome的字体平滑效果没有IE9好，难道Cleartype技术是微软独有的？</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://badst.org/2012/01/%e6%a3%80%e6%b5%8b%e6%b5%8f%e8%a7%88%e5%99%a8%e6%98%af%e5%90%a6%e6%94%af%e6%8c%81css3%e5%92%8chtml5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

