セレクターその14(last-child擬似クラス[CSS3])

これも〜、最後の合計金額を出す為のフッターとかで背景色を指定したいときとか使えるか。
そんなこと行ったらfirst-childもヘッダーのバックカラー指定できるな。

<html>
  <head>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">google.load("jquery", "1.3.2");</script>
    <script type="text/javascript">
      $(function() {
        $("li:last-child").css("color","red");
        $("#table0").css("width","500px");
        $("#table0 tr:last-child").css("background-color","pink");
        $("#table0 tr:first-child").css("text-align","center");
        $(".num").css("text-align","right");
      })
    </script>
  </head>
  <body>
    <ul>
      <li>テキストテキストテキストテキストテキスト</li>
      <li>テキストテキストテキストテキストテキスト</li>
      <li>テキストテキストテキストテキストテキスト</li>
      <li>テキストテキストテキストテキストテキスト</li>
    </ul>
    <table id="table0" border="1">
      <tr><td>項目</td><td>単価</td><td>個数</td><td>小計</td>
      <tr>
	<td>商品1</td>
	<td class="num">100</td>
	<td class="num">2</td>
	<td class="num">200</td>
      </tr>
      <tr>
	<td>商品2</td>
	<td class="num">500</td>
	<td class="num">5</td>
	<td class="num">2500</td>
      </tr>
      <tr>
	<td>商品3</td>
	<td class="num">1000</td>
	<td class="num">3</td>
	<td class="num">3000</td>
      </tr>
      <tr>
	<td colspan="3">合計</td>
	<td class="num">5700</td>
      </tr>
    </table>
  </body>
</html>

こーやって使うのねぇ。