CSS学习笔记10:超链接样式

13 篇文章 0 订阅

超链接伪类

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>超链接伪类</title>
    <!--超链接伪类    用来定义超链接在鼠标点击的不同时期的样式-->
    <!--a:link	    定义a元素未访问时的样式-->
    <!--a:visited	定义a元素访问后的样式-->
    <!--a:hover	    定义鼠标经过a元素时的样式-->
    <!--a:active	定义鼠标点击激活时的样式-->
    <style>
        /*a {*/
        /*    text-decoration: none;*/
        /*}*/

        /*a:link {*/
        /*    color: red;*/
        /*}*/

        /*a:visited {*/
        /*    color: green;*/
        /*}*/

        /*a:hover {*/
        /*    color: orange;*/
        /*}*/

        /*a:active {*/
        /*    color: blue;*/
        /*}*/

        /*一般只用定义未访问时状态和鼠标经过状态*/
        a {
            color: red;
            text-decoration: none;
        }

        a:hover {
            color: blue;
            text-decoration: underline;
        }
    </style>
</head>
<body>
<a href="https://www.baidu.com" target="_blank">百度一下</a>
</body>
</html>

在这里插入图片描述

深入了解:hover

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>深入了解:hover</title>
    <style>
        div {
            width: 100px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            color: white;
            background: lightskyblue;
        }

        /*:hover伪类不仅仅用于a元素*/
        div:hover {
            background-color: hotpink;
        }

        img:hover {
            border: 2px solid red;
        }
    </style>
</head>
<body>
<div>百度一下</div>
<img src="img/htmlcssjs-overview.png" alt="">
</body>
</html>

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

鼠标样式

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>鼠标样式</title>
    <!--cursor属性 定义鼠标样式 常用有三种-->
    <!--default   默认鼠标样式-->
    <!--pointer   鼠标点击样式-->
    <!--text      鼠标文本样式-->
    <style>
        div {
            width: 100px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            background-color: hotpink;
            color: white;
            font-size: 14px;
        }

        #div_default {
            cursor: default;
        }

        #div_pointer {
            cursor: pointer;
        }
    </style>
</head>
<body>
<div id="div_default">鼠标默认样式</div>
<div id="div_pointer">鼠标手装样式</div>
</body>
</html>

在这里插入图片描述

练习

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Practice</title>
    <style>
        a {
            color: red;
            text-decoration: none;
        }

        a:hover {
            color: blue;
            text-decoration: underline;
        }
    </style>
</head>
<body>
<a href="https://www.baidu.com" target="_blank">百度一下,你就知道</a>
</body>
</html>

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值