如何利用CSS去除超連結的底線的方法介紹

來源:互聯網
上載者:User
我們可以用CSS文法來控制超連結的形式、顏色變化,為什麼連結一定要使用底線和顏色區分呢? 其主要原因主要是考慮到 1、視力差的人 2、色盲的人 。。。

下面我們做一個這樣的連結:未被點擊時超連結顯示文字無底線,顯示為藍色;當滑鼠在連結上時有底線,連結文字顯示為紅色;當點選連結後,連結無底線,顯示為綠色。

實現方法很簡單,在原始碼的<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 指正在點的連結;
  a:hover 指滑鼠在連結上;
  a:visited 指已經訪問過的連結;
  text-decoration是文字修飾效果的意思;
  none參數表示超連結顯示文字不顯示底線;
  underline參數表示超連結的文字有底線
-------------------------------------------------------------------------
示範:讓網頁中的連結去掉底線

<style type="text/css"> <!-- A { text-decoration: none} --> </style>

將代碼插入在<head></head>之間.<title>之前即可

-------------------------------------------------------------------------

使用CSS實現連結的虛線底線\普通底線效果

a {color:#3399FF;font-weight:Normal; /*CSS字型效果 普通 可以改成bold粗體 如果去除此行那麼預設是不顯示底線的*/text-decoration:none; /*CSS底線效果:無底線*/}
a:hover {color:#4499EE;text-decoration:none; /*CSS底線效果:無底線*/border-bottom: 1px #0099CC dotted /*CSS加一個只有下邊的框 邊框為虛線*/}
a{ } :是用來控制串連的效果 a:hover{ }:是用來控制滑鼠移上去的效果。
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.