Published at Friday, July 4, 2008.
我目前知道两种基于CSS的三栏布局方式。第一种叫“嵌套”,第二种叫“挤压”。(名目都是我自己编的)
1. 嵌套。这个简单,大部分三栏布局都用这个,我想。就是两个div(AB和C),在其中一个中嵌上两个div(A和B)。

CSS代码是:
- #AB { float:left; }
- #A { float:left; }
- #B { float:right; }
- #C { float:right; }
- .clear { clear:both; }
HTML代码是:
- <html>
- <body>
- <div id="AB">
- <div id="A"></div>
- <div id="B"></div>
- <div class="clear"></div>
- </div>
- <div id="C"></div>
- <div class="clear"></div>
- </body>
- </html>
2. 挤压。这个也不难。先让A、C漂浮在左右两边,B左右Padding出A、C的宽度,这样B就把A、C挤到两边成为中间一栏了。需要注意的是,在HTML代码中,要先A、C块,再B块。

CSS代码是:
- #A { float:left; width:200px; }
- #B { padding:5px 200px; }
- #C { float:right; width:200px; }
- .clear { clear:both; }
HTML代码是:
- <html>
- <body>
- <div id="A"></div>
- <div id="C"></div>
- <div id="B"></div>
- <div class="clear"></div>
- </body>
- </html>
Published at Friday, February 22, 2008.
书架+楼梯是怎样,书梯?看图就明白了。
(从上往下看)

(从下往上看)

精巧的设计。每层的交错都是读书的坐处。不过似乎防水性差了一些。
有那么多书是幸福,放在哪儿是个问题,大家开动脑筋吧。
VIA [疯狂的设计]
Published at Thursday, January 24, 2008.
没想到我竟然会自己弄了一个Wordpress插件。这个插件我把它叫做Random Images,因为我是以random、image这两个关键字,在Snipplr Code 2.0里找到这个插件的核心代码—Simple PHP Randomizer的。它的功能,顾名思义,就是随机显示图片。效果见H!Beauty侧栏。
下载(donwload): Random Images 0.1
使用的话,我还没弄懂如何在后台添加设置界面,所以目前只能是通过后台的Plugin Editor手工修改了。还好,修改起来不算麻烦。点击这里可以查看完整的代码。
下面这一串代码记录随机图片的信息,如链接、图片链接等,只要照着输入就可以了。加入更多图片的话,只需自行添加array,4、5、6….这样就可以了。
- 1 => array(
- 'href' => '链接',
- 'title' => '链接名',
- 'src' => '图片链接',
- 'alt' => '图片alt属性值'
- ),
- 2 => array(
- 'href' => 'url',
- 'title' => 'text',
- 'src' => 'image-url',
- 'alt' => 'text'
- ),
- 3 => array(
- 'href' => 'url',
- 'title' => 'text',
- 'src' => 'image-url',
- 'alt' => 'text'
- ),
- // add more data here
随机显示几张图片则修改下面代码中的阿拉伯数字即可。
- $numberOfItems = 2; // Change to the number of items you want show
Ok,大功告成。哎,其实只是简单的拼凑。
Published at Thursday, November 15, 2007.
我想在存档(Archive)页面上加上一条提示信息,如“您正在浏览Tag为Wordpress的存档页面”,或“您正在浏览2007年11月的存档页面”。看了Codex文档,知道要用is_tag+single_tag_title组合,不过加进Theme里去费了一些时间。看来自己还是PHP白痴,所以记录一下。
首先Theme里得有个Archives(archive.php),当然没有也可以,加在Main Index Template(index.php)里也行。我这个Theme没有archive.php,而有了archive.php后,所有存档页包括月、年、分类等都会调用它来显示,Tag也是如此。判断是哪种存档页并显示相应的提示信息需要下面的语句(来自WP Glass):
- <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
- <?php /* If this is a category archive */ if (is_category()) { ?>
- <h3>You're Browsering Archive for the '<?php echo single_cat_title(); ?>' Category</h3>
-
- <?php /* If this is a tag archive */ } elseif (is_tag()) { ?>
- <h3>You're Browsering Archive for the ‘<?php echo single_tag_title(); ?>’ Tag</h3>
-
- <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
- <h3>You're Browsering Archive for <?php the_time('F jS, Y'); ?></h3>
-
- <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
- <h3>You're Browsering Archive for <?php the_time('F, Y'); ?></h3>
-
- <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
- <h3>You're Browsering Archive for <?php the_time('Y'); ?></h3>
-
- <?php /* If this is a search */ } elseif (is_search()) { ?>
- <h3>Search Results</h3>
-
- <?php /* If this is an author archive */ } elseif (is_author()) { ?>
- <h3>Author Archive</h3>
上面的语句加在if while语句–也就是下面两句之间
- <?php if (have_posts()) { ?>
- <?php while (have_posts()) : the_post(); ?>
现在提示信息就能“自动判断”显示了。不过Theme里有tag.php的话,Tag存档页是调用tag.php,可以在其中你希望显示的位置加上single_tag_title。
- You're Browsering Archive for the ‘<?php echo single_tag_title(); ?>’ Tag
Published at Tuesday, May 22, 2007.
表单(List)在网页设计中时常用到。下图是四种表单目录设计。

这是怎样实现的?这里有详尽的教程。写得很好,分步骤讲解,不是简单地告知代码让你复制粘贴,一步一步下来,也懂得了不少CSS知识。
我草创中的Theme就使用了其中一种目录导航。站点里还有其它不错的教程,我得补补课了。
Published at Thursday, May 17, 2007.
Derek Powazek的blog很清爽,我很喜欢,就下载来参考。
Mr. Powazek没有使用tag系统,而是用category来代替tag。这样就可以少装一个tag插件,只要不在侧栏显示(很多theme都没有侧栏)categories,也不会显得凌乱。很“环保”的替代品,符合整个站点朴素简单的风格。简单是真,简单是美。没必要有太多的色彩和元素,让阅读者能“安静地”阅读最重要。
不过tag太多了以后也是个问题。(比如我这样乱加tag的)