大一新生如何超链接背景颜色带下划线用html+css

img

设置a标签的下边框出颜色就可以


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        a{
            text-decoration: none;
            /* //去掉默认下划线 */
        }
        a:hover{
            border-bottom: 1px solid #cecece;
        }
    </style>
</head>
<body>
    <a href="#">下划线</a>
</body>
</html>

a:link {background-color:#B2FF99;}
a:visited {background-color:#FFFF85;}
a:hover {background-color:#FF704D;}
a:active {background-color:#FF704D;}