<style>

a[src*="abc"]:hover > SPAN

{

background-color:red;

}

</style>

<A href="javascript:void(0)">TE<SPAN>ST</SPAN>1</A> <BR>

<A href="javascript:void(0)" src ="123 abc 456" > TE <SPAN> ST2 </SPAN> </A> <BR>

<A href="javascript:void(0)" src="123456"  >TEST1</A> <BR>


答案在滑鼠移至 第二個 A 元素上時,A 下面的 SPAN 的背景就會變紅色。

需注意的是,滑鼠不需要移至 SPAN 元素上 ,就可以讓 SPAN 變色 !

一般來說這樣寫就好

<style>

BODY                                                                       /* 預設背景是 白色 */

{

background-color: WHITE ;

}

@media screen and ( max-width :440px)      /* 440px 以下 背景是 紅色 */

{

BODY

{

background-color: RED ;

}

}

@media screen and ( max-width :860px)    /* 860px 以下 背景是 藍色 */

{

BODY

{

background-color: BLUE ;

}

}

</style>

但是有點不正確 !  哪裡呢 ?

瀏覽器寬度為 360px 時

BODY                                                        /* 預設背景是 白色 */

background-color:WHITE;

@media screen and (max-width: 440px )    /* 440px 以下 背景是紅色 */

background-color: RED ;

@media screen and (max-width:860px)    /* 860px 以下 背景是藍色 */

background-color:BLUE;

條件符合,但排在比較後面,故優先採用

上述設定不符合我們的期待 ! 所以必須修改順序

BODY                                                        /* 預設背景是 白色 */

{

background-color:WHITE;

}

@media screen and (max-width:860px)    /* 860px 以下 背景是藍色 */

{

BODY

{

background-color:BLUE;

}

}

@media screen and (max-width: 440px )    /* 440px 以下 背景是紅色 */

{

BODY

{

background-color: RED ;

}

}

移到最下面 才對