このページの目次

IE 5.5 と 6 で :first-child

概要

IE 5.5 と 6 で 擬似的に CSS の :first-child を使うための expression です。expression とはIE 独自拡張で、CSS を使って JavaScript と似たことが書ける機能です。IE 以外のブラウザでは無視されます。

css 内に書くことができるので JavaScript などで別ファイルにして :first-child を実現するよりも管理しやすいです。しかし、IE の独自拡張をつかっているので CSS のソースコードがやや増え、valid ではなくなります。また JavaScript が利用できない場合は動作しません。

説明

あとで書きます…

ソースコード

.sample p:first-child{color:#f00;}

.sample p.first-child{ /*IE-expression (first-child) */
color:#f0f;
}
.sample p{ /* IE-expression (first-child) */
behavior: expression(
this.className += (this.previousSibling == null) ? " first-child" : "",
this.style.behavior = "none"
);
}


トラックバックURI

http://www.yomotsu.net/lab/css/iefirstchild/trackback

この記事へのコメントはまだありません

コメントフォーム

コメント

コメントでは一部の XHTML タグを使用できます。 : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

実験室に戻る

著作権情報等

Copyright © 2004-2008 yomotsu-net. Some Rights Reserved.