1

リンクの束にデフォルトのクラスを追加しようとしています。だから代わりに

<a href=1 class=text1>1</a>
<a href=2 class=text1>2</a>
<a href=3 class=text1>3</a>
<a href=4 class=text1>4</a>
<a href=5 class=text1>5</a>
<a href=6 class=text1>6</a>
<a href=7 class=text1>7</a>

私はやってみたいです

<span class=text1>
<a href=1 >2</a>
<a href=2 >3</a>
<a href=3 >4</a>
<a href=4 >5</a>
<a href=5 >6</a>
<a href=6 >7</a>
<a href=7 >8</a>
</span>

text1 クラスは次のようなものです。

a.text1:link { color: white; text-decoration: underline ;}
a.text1:active { color: white; text-decoration: underline ;}
a.text1:visited { color: white; text-decoration: underline ;}
a.text1:hover { color: white; text-decoration: underline ;  }

ただし、2 番目のオプションは機能しないようです。私は愚かですか、またはこのようなグループ内の一連のリンクをクラスに従うようにする方法はありますか?

4

3 に答える 3

3

使用する:

span.text1 a:link { color: white; text-decoration: underline ;}
span.text1 a:active { color: white; text-decoration: underline ;}
span.text1 a:visited { color: white; text-decoration: underline ;}
span.text1 a:hover { color: white; text-decoration: underline ;  }
于 2012-06-08T18:11:37.043 に答える
1

単純に使用します:

span.text1 a:link {
    /* css */
}

または、必要に応じて、第 1 レベルの子孫である「直接の」子のみを選択します。

span.text1 > a:link {
    /* css */
}
于 2012-06-08T18:11:33.767 に答える
1

そのようには機能しません。これを試して

span.text1 a:link { color: white; text-decoration: underline ;}
span.text1 a:active { color: white; text-decoration: underline ;}
span.text1 a:visited { color: white; text-decoration: underline ;}
span.text1 a:hover { color: white; text-decoration: underline ;  }
于 2012-06-08T18:11:51.620 に答える