2007年7月7日

新しいサイト”わーどぷれすっ!”をオープンしました。

今後はWordPress関連の話題は全部このサイトに投稿していきます。プラグイン一覧もこの新サイトに移しましたので、ドウゾよろしくお願いします。

WordPress テーマの詳説:第三章

Registry First Aid will find these invalid entries and remove them from your registry. With Registry First Aid, your Windows registry will be always clean and correct, helping your programs load faster and speeding up your computer. Fast, easy to use, PC speed testing and benchmarking. PassMark PerformanceTest allows you to objectively benchmark a x blades keygen PC using a variety of different speed tests and compare the results to other computers. Twenty-eight standard benchmark tests are available in six test suites plus there are seven advanced testing windows for custom benchmarking. In addition to the standard tests, there are 7 summary results plus the overall PassMark Rating result. The benchmark results are xilisoft keygen presented as easy to read bar charts so that you dont need to spend hours studying the number to know the result. Timing for the tests is done using high resolution timers, which are accurate to approximately 1 millionth of a second on most PCs. Create professional-quality advertising, sophisticated print designs and electronic documents with PagePlus sims 2 keygen X5, the best-in-class desktop publisher.

ステップ3 – サイドバーのスタイリング

これまではサイドバーの PHP 関数について説明していくつか変更してきた。サイドバーの外観はまだとても簡単なものなので、今度はこれをスタイリングしていく。

おぼえていると思うが、サイドバーは順序なしのリストで構成され、各リスト項目が一つのセクションになっている。 これら各セクションはたいてい見出しとそれに続く別の順序なしリストで構成されている。 デフォルトでは順序なしリストは黒丸で始まるようになっている。 これは決して見出しに望むものではない。

最初のステップは一番上のリスト階層から黒丸を取り除くことだ:

#sidebar ul
{
  list-style: none;
}

残念なことに、こうするとサブリストを含むすべての順序なしリストから黒丸が取り除かれてしまう。 もう一つスタイルをつけるとこの問題は解決できる:

#sidebar ul ul
{
  list-style-image: URL(images/listitem.png);
  list-style-type: circle;

}

これによってサブリストを持つ順序なしリストに黒丸をつける。 ここではリストのマークとしてイメージを使用し、イメージが見つからない場合は白丸を表示するようにしてある。

これではリストマークが左に寄りすぎてよくないし、階層の字下げもない。 その原因は前回のガイドで導入したすべてのマージンをゼロにリセットする全体的なスタイリングにある。 次のスタイルを追加すればすべてもとに戻る:

#sidebar ul ul
{
  list-style-image: url(images/listitem.png);
  list-style-type: circle;

  margin-left: 20px;
}

これで望み通りになった:

覚えておいてほしいのだが、これを含めすべてのスタイルは最適化されているわけではない。 これは WordPress を理解するためのガイドであり、必要なだけ冗長になる。 最小最適化された CSS コードを書くためのガイドではない。

では次に、このサイドバーと見出しにいくつか色とボーダーを追加してみよう。

  1. #sidebar
  2. {
  3.   background-color: #FCF1E2;
  4.   color: #4A2C00;
  5.   border: 1px solid #FDE5C3;
  6. }
  7.  
  8. #sidebar ul h2
  9. {
  10.   background-color: #FDE5C3;
  11.   border-bottom: 1px solid #FADA96;
  12.   border-top: 1px solid #FADA96;
  13.   font-size: 1.2em;
  14.   font-weight: normal;
  15.   padding: 2px;
  16.   margin-bottom: 5px;
  17. }

複雑に見えるが次のような変更として要約できる:

  • サイドバーの背景と見出しに色を追加(3、4、10)
  • サイドバーの周りと見出しの上下にボーダーを追加(5、11、12)
  • 見出しのフォントを 1.2em に設定。すべてのブラウザで基準となる。(13、14)
  • もっと間を空けるため見出しのマージンとパディングを変更(15、16)

スタイリングはほぼ完成しているが、まだスペースを調整することができる。 一番分かりやすい変更は見出しと前のリストの間にもっとスペースを入れることだ。 見出しの上(top)にマージンを追加することもできるが、そうすると一番上の見出しが下がってしまい見てくれがよくない。 かわりに、リストスタイルには見出しの下(bottom)にマージンを追加してみよう:

#sidebar ul
{
  list-style: none;
  margin-bottom: 10px;

}

これでうまくはいくのだが、サブリストを含むすべてのリストにマージンが導入されてしまう:

こうしたサブ-サブ-リストのマージンをリセットする必要がある。

#sidebar ul ul ul
{
  margin-bottom: 0;
}

これですべての見栄えが良くなった:

This entry was posted in WordPress, WP ヒント. Bookmark the permalink.

One Response to WordPress テーマの詳説:第三章

コメントを残す

メールアドレスが公開されることはありません。

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>