我們可以用CSS語法來控制超鏈接的形式、顏色變化。
下面我們做一個這樣的鏈接:未被點(diǎn)擊時超鏈接文字無下劃線,顯示為藍(lán)色;當(dāng)鼠標(biāo)在鏈接上時有下劃線,鏈接文字顯示為紅色;當(dāng)點(diǎn)擊鏈接后,鏈接無下劃線,顯示為綠色。
實(shí)現(xiàn)方法很簡單,在源代碼的<head>和<head>之間加上如下的CSS語法控制:
<style type="text/css"> <!-- a:link { text-decoration: none;color: blue} a:active { text-decoration:blink} a:hover { text-decoration:underline;color: red} a:visited { text-decoration: none;color: green} --> </style>
其中: a:link 指正常的未被訪問過的鏈接; a:active 指正在點(diǎn)的鏈接; a:hover 指鼠標(biāo)在鏈接上; a:visited 指已經(jīng)訪問過的鏈接; text-decoration是文字修飾效果的意思; none參數(shù)表示超鏈接文字不顯示下劃線; underline參數(shù)表示超鏈接的文字有下劃線
下面這行文字就是我們剛才做的效果。
效果演示
同樣,如果講none替換成overline則給超鏈接文字加上劃線,換成line-through給超鏈接文字加上刪除線,blink則使文字在閃爍。
|