WEBマスター目指して日々勉強!!
first-child:ある親要素の最初の子供要素だけマッチします。
具体例) p:first-child { font-weight:bold; } <p>1</p> <p>2</p> <p>3</p> ただ、IE 5.5 と 6 は機能しません。 そこで「expression(IE 独自拡張)」を使い使用できるようにします。 ※JavaScriptが無効だと機能しません。。。 使用例) p:first-child{ font-weight:bold; } p.first-child{ /*IE-expression (first-child) */ font-weight:bold; } p{ /* IE-expression (first-child) */ behavior: expression( this.className += (this.previousSibling == null) ? " first-child" : "", this.style.behavior = "none" ); } スポンサーサイト
|
|
|
| ホーム |