<?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>Linux ABC &#187; theme</title>
	<atom:link href="http://www.linuxabc.net.cn/tag/theme/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxabc.net.cn</link>
	<description>那些人/那些事...</description>
	<lastBuildDate>Tue, 09 Feb 2010 14:09:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>LinuxABC主题之等高布局</title>
		<link>http://www.linuxabc.net.cn/uncategorized/how-to-make-linuxabc-theme-from-scratch_equal-height-layout.html</link>
		<comments>http://www.linuxabc.net.cn/uncategorized/how-to-make-linuxabc-theme-from-scratch_equal-height-layout.html#comments</comments>
		<pubDate>Tue, 09 Dec 2008 16:25:16 +0000</pubDate>
		<dc:creator>alfie</dc:creator>
				<category><![CDATA[其他]]></category>
		<category><![CDATA[linuxabc]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.linuxabc.net.cn/uncategorized/how-to-make-linuxabc-theme-from-scratch_equal-height-layout.html/</guid>
		<description><![CDATA[LinuxABC采用了传统的布局：
 
由于目前content和sidebar未设背景色，沿用了body的#，显得很呆板，而且读者不容易将视线聚焦在左边的内容上，所以alfie决定将content的背景色改成白色，sidebar的颜色改成灰色系，改完之后发现两边不等高，如下图的左边所示，其实alfie的的初衷是实现右边的效果。
 
于是上网搜了一下，原来这个问题早已有之，众人也是八仙过海各显神通，总结了一下有以下四种解决方法。
一、分层交错法
英文原文是：Equal Height Columns with Cross-Browser CSS &#38; No Hacks 
原文的例子是三栏的，定义三个不同背景色的div：
 
通过控制width的百分比，将各个层错落显示，达到每个col显示不同的颜色，而且是等高的。
 
详细的实现方式请参阅原文。
二、border-right
alfie无意中进入http://www.alistapart.com/，看到了border-right这种解决方式，下面以LinuxABC为例简要说明。
首先将wrapper的背景色设为白色，content也设为白色，并且border-right的宽度为sidebar的宽度，sidebar的背景色设为#EDEDED 

当content高于sidebar时，由于content的border-right的颜色即为sidebar的背景色，因此sidebar短缺的部分由content的border-right背景色不足；
当sidebar高于content时，由于wrapper是content和sidebar的父容器，content短缺的背景由wrapper补足；

这样就实现了两栏等高的问题，如果读者想知道三栏的实现方式，可以参考原文：Multi-Column Layouts Climb Out of the Box 
index.php: 

&#60;div id=&#34;wrapper&#34;&#62; &#60;div id=&#34;content&#34;&#62;This is the content&#60;/div&#62; &#60;div id=&#34;sidebar&#34;&#62;This is the sidebar&#60;/div&#62; &#60;/div&#62;

style.css: 

#wrapper&#123;
   background-color: #FFFFFF;
   overflow: hidden;
   width: 100%;
&#125;
#content&#123;
   background-color: #FFFFFF;
   width: [...]]]></description>
			<content:encoded><![CDATA[<p>LinuxABC采用了传统的布局：</p>
<p><a href="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/classicallayoutwithfloats.png"><img title="classical-layout-with-floats" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="338" alt="classical-layout-with-floats" src="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/classicallayoutwithfloats-thumb.png" width="500" border="0" /></a> </p>
<p>由于目前content和sidebar未设背景色，沿用了body的#，显得很呆板，而且读者不容易将视线聚焦在左边的内容上，所以alfie决定将content的背景色改成白色，sidebar的颜色改成灰色系，改完之后发现两边不等高，如下图的左边所示，其实alfie的的初衷是实现右边的效果。</p>
<p><a href="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/equalheightcolumnsproblem.gif"><img title="equal-height-columns-problem" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="250" alt="equal-height-columns-problem" src="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/equalheightcolumnsproblem-thumb.gif" width="450" border="0" /></a> </p>
<p>于是上网搜了一下，原来这个问题早已有之，众人也是八仙过海各显神通，总结了一下有以下四种解决方法。</p>
<h4>一、分层交错法</h4>
<p>英文原文是：<a title="Equal Height Columns with Cross-Browser CSS &amp; No Hacks" href="http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks " target="_blank">Equal Height Columns with Cross-Browser CSS &amp; No Hacks</a> </p>
<p>原文的例子是三栏的，定义三个不同背景色的div：</p>
<p><a href="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/equalheightcolumns3containers.gif"><img title="equal-height-columns-3-containers" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="205" alt="equal-height-columns-3-containers" src="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/equalheightcolumns3containers-thumb.gif" width="350" border="0" /></a> </p>
<p>通过控制width的百分比，将各个层错落显示，达到每个col显示不同的颜色，而且是等高的。</p>
<p><a href="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/equalheightcolumnscontainerpositions.gif"><img title="equal-height-columns-container-positions" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="632" alt="equal-height-columns-container-positions" src="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/equalheightcolumnscontainerpositions-thumb.gif" width="497" border="0" /></a> </p>
<p>详细的实现方式请参阅原文。</p>
<h4>二、border-right</h4>
<p>alfie无意中进入<a href="http://www.alistapart.com/">http://www.alistapart.com/</a>，看到了border-right这种解决方式，下面以LinuxABC为例简要说明。</p>
<p>首先将wrapper的背景色设为白色，content也设为白色，并且border-right的宽度为sidebar的宽度，sidebar的背景色设为#EDEDED </p>
<ul>
<li>当content高于sidebar时，由于content的border-right的颜色即为sidebar的背景色，因此sidebar短缺的部分由content的border-right背景色不足；</li>
<li>当sidebar高于content时，由于wrapper是content和sidebar的父容器，content短缺的背景由wrapper补足；</li>
</ul>
<p>这样就实现了两栏等高的问题，如果读者想知道三栏的实现方式，可以参考原文：<a title="Multi-Column Layouts Climb Out of the Box" href="http://www.alistapart.com/articles/multicolumnlayouts " target="_blank">Multi-Column Layouts Climb Out of the Box</a> </p>
<h5>index.php: </h5>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;wrapper&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #339933;">&gt;</span>This is the content<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;sidebar&quot;</span><span style="color: #339933;">&gt;</span>This is the sidebar<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<h5>style.css: </h5>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#wrapper</span><span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#content</span><span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">600px</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">border-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">400px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#EDEDED</span><span style="color: #00AA00;">;</span> 
   <span style="color: #808080; font-style: italic;">/* The width and color of the sidebar */</span>
   <span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-400px</span><span style="color: #00AA00;">;</span> 
   <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#sidebar</span><span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#EDEDED</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>说明：知道<a href="http://www.alistapart.com/">http://www.alistapart.com/</a>是谁创建的吗？是《网站重构》的作者Jeffrey Zeldman，alfie也是今天到书店无意中在《网站重构》这本书中发现的，这个世界好奇妙。</p>
<h4>三、JavaScript</h4>
<p>通过JavaScript或jquery的插件也可以实现多栏之间的等高，不过这种方式应用面不广，所以这里就不详谈了。</p>
<h4>四、table</h4>
<p>这是下下策，在没有css之前table的确是网页设计师的挚爱，但现已经是昔日黄花了，不提也罢。</p>
<p>alfie最终决定采用第二种方法，因为它够简单，效果也不错，方法一虽然很强大，但似乎过于小题大做了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxabc.net.cn/uncategorized/how-to-make-linuxabc-theme-from-scratch_equal-height-layout.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LinuxABC主题之圆角</title>
		<link>http://www.linuxabc.net.cn/wordpress/how-to-make-linuxabc-theme-from-scratch_rounded-corners.html</link>
		<comments>http://www.linuxabc.net.cn/wordpress/how-to-make-linuxabc-theme-from-scratch_rounded-corners.html#comments</comments>
		<pubDate>Tue, 09 Dec 2008 15:05:28 +0000</pubDate>
		<dc:creator>alfie</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[linuxabc]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.linuxabc.net.cn/wordpress/how-to-make-linuxabc-theme-from-scratch_rounded-corners.html/</guid>
		<description><![CDATA[在web2.0的时代，网页设计大量采用了圆角效果，套用《大腕》里的一句台词就是“你不圆都不好意思跟别人打招呼。”，alfie也不能免俗，决定为LinuxABC的页面元素加入圆角效果。
目前实现圆角效果的主流方式有两种，一种是CSS+DIV，另一种是使用圆角图片。这两种方法对alfie来说都不方便，第一种需要掌握复杂的div嵌套，而且圆角无法做到抗锯齿；第二种则需要使用图像处理工具，而alfie最怕的就是去学习photoshop这个庞然大物，所以决定另辟蹊径。
曾经见过有人用JavaScript解决过圆角问题，而LinuxABC将大量采用jquery，所以alfie搜索了一下jquery的官方网站，还真的有好事者做了圆角效果的插件，而且还不少：

JQuery Curvy Corners 
JCorners 
JQuery Corner Gallery 
rounded corners 

对比一下上面几个插件，alfie最终决定采用rounded corners。因为另外三个插件不支持在div里直接提供参数，当多个页面元素的圆角弧度均不相同的时候需要用户在$(&#34;#ElementID&#34;).corner()中单独提供参数，这就造成展示层跟代码层的混合，不利于后期的维护。下面以一个例子展示JQuery Corner Galley和Rounded Corners两个插件的不同之处。
为LinuxABC的

topNavi的左上角和右上角做圆角效果； 
wrapper的左下角和右下角做圆角效果； 

&#160;  
JQuery Corner Galley：

&#60;script&#62;
   $(document).ready(function(){
      ...
      $('#topNavi').corner(&#34;round top 4px&#34;);
      $('#content').corner(&#34;round bottom 5px&#34;);
      ...
   });
&#60;/script&#62;
&#60;div id=&#34;topNavi&#34;&#62;...&#60;/div&#62;
&#60;div [...]]]></description>
			<content:encoded><![CDATA[<p>在web2.0的时代，网页设计大量采用了圆角效果，套用《大腕》里的一句台词就是“你不圆都不好意思跟别人打招呼。”，alfie也不能免俗，决定为LinuxABC的页面元素加入圆角效果。</p>
<p>目前实现圆角效果的主流方式有两种，一种是CSS+DIV，另一种是使用圆角图片。这两种方法对alfie来说都不方便，第一种需要掌握复杂的div嵌套，而且圆角无法做到抗锯齿；第二种则需要使用图像处理工具，而alfie最怕的就是去学习photoshop这个庞然大物，所以决定另辟蹊径。</p>
<p>曾经见过有人用JavaScript解决过圆角问题，而LinuxABC将大量采用jquery，所以alfie搜索了一下jquery的官方网站，还真的有好事者做了圆角效果的插件，而且还不少：</p>
<ol>
<li><a title="JQuery Curvy Corners" href="http://plugins.jquery.com/project/curvy-corners" target="_blank">JQuery Curvy Corners</a> </li>
<li><a title="JCorners" href="http://plugins.jquery.com/project/JCorners" target="_blank">JCorners</a> </li>
<li><a title="JQuery Corner Gallery" href="http://methvin.com/jquery/jq-corner.html" target="_blank">JQuery Corner Gallery</a> </li>
<li><a title="rounded corners" href="http://plugins.jquery.com/project/corners" target="_blank">rounded corners</a> </li>
</ol>
<p>对比一下上面几个插件，alfie最终决定采用rounded corners。因为另外三个插件不支持在div里直接提供参数，当多个页面元素的圆角弧度均不相同的时候需要用户在$(&quot;#ElementID&quot;).corner()中单独提供参数，这就造成展示层跟代码层的混合，不利于后期的维护。下面以一个例子展示JQuery Corner Galley和Rounded Corners两个插件的不同之处。</p>
<h6>为LinuxABC的</h6>
<ol>
<li>topNavi的左上角和右上角做圆角效果； </li>
<li>wrapper的左下角和右下角做圆角效果； </li>
</ol>
<p><a href="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/topnaviroundedcornerssample.png"><img title="topnavi.rounded.corners.sample" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="46" alt="topnavi.rounded.corners.sample" src="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/topnaviroundedcornerssample-thumb.png" width="204" align="left" border="0" /></a>&#160; <a href="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/wrapperbottomroundedcornerssample.png"><img title="wrapper.bottom.rounded.corners.sample" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="92" alt="wrapper.bottom.rounded.corners.sample" src="http://www.linuxabc.net.cn/wp-content/uploads/2008/12/wrapperbottomroundedcornerssample-thumb.png" width="204" border="0" /></a> </p>
<h5>JQuery Corner Galley：</h5>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script&gt;
   $(document).ready(function(){
      ...
      $('#topNavi').corner(&quot;round top 4px&quot;);
      $('#content').corner(&quot;round bottom 5px&quot;);
      ...
   });
&lt;/script&gt;
&lt;div id=&quot;topNavi&quot;&gt;...&lt;/div&gt;
&lt;div id=&quot;content&quot;&gt;...&lt;/div&gt;</pre></div></div>

<h5>Rounded Corners：</h5>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script&gt;
   $(document).ready(function(){
      ...
      $('.rounded').corner();
      ...
   });
&lt;/script&gt;
&lt;div class=&quot;rounded {4px top}&quot; id=&quot;topNavi&quot;&gt;...&lt;/div&gt;
&lt;div class=&quot;rounded {5px bottom-left}&quot; id=&quot;content&quot;&gt;...&lt;/div&gt;</pre></div></div>

<p>rounded corners这种方式无疑更方便些，而且后期的维护相对简单。 </p>
<p>短短几行代码就能搞定大部分的圆角效果，jquery实在是太神奇，想不爱她都不行！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxabc.net.cn/wordpress/how-to-make-linuxabc-theme-from-scratch_rounded-corners.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
