css超链接的伪类中表示鼠标悬浮上的是

html-css020

css超链接的伪类中表示鼠标悬浮上的是,第1张

css超链接的伪类中表示鼠标悬浮上的是hover。要定义链接样式,其中必不可少的就是超级链接中的锚标签,锚标签和伪类链接起来书写的方法就是定义链接样式的基础方法,写法如下:link,定义正常链接的样式。visited,定义已访问过链接的样式。hover,定义鼠标悬浮在链接上时的样式。active,定义鼠标点击链接时的样式。其中::link和:visited只能用于设置超链接a,:hover和:active则可适用所有元素,hover用来表示鼠标移入的状态,active用来表示鼠标点击。

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>鼠标悬停效果</title>

    <style type="text/css">

        *{

            margin: 0

            padding: 0

        }

        body{

            background-color: #000

        }

        a{

            width: 200px

            height: 50px

            display: block

            text-align: center

            line-height: 50px

            text-decoration: none

            position: absolute

            top: 50%

            left: 50%

            transform: translate(-50%,-50%)

            font-size: 24px

            font-weight: bold

            color: white

            border: 1px solid white

            overflow: hidden

        }

        a::before{

            content: ""

            position: absolute

            top: 0

            left: -100%

            width: 100%

            height: 100%

            background-image: linear-gradient(60deg,transparent,rgba(146,148,248,.4),transparent)

            transition: all 0.5s

        }

        a:hover::before{

            left: 100%

        }

        a:hover{

            box-shadow: 0 2px 10px 8px rgba(146,148,248,.4)

        }

    </style>

</head>

<body>

    <a href="#">鼠标悬停效果</a>

</body>

</html>

CSS+HTML<悬停下划线效果>

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <title>Document</title>

    <style>

        body {

            display: flex

            height: 100vh

            justify-content: center

            align-items: center

        }

        ul {

            padding: 0

            margin: 0

            list-style-type: none

        }

        ul li{

            padding: 5px 0

        }

        ul li a {

            position: relative

            display: inline-block

            text-decoration: none

            color: #3a3a3a

            /* 转大写 */

            text-transform: uppercase

            padding: 4px 0

            transition: 0.5s

            font-weight: bold

        }

        ul li a::after {

            position: absolute

            content: ""

            width: 100%

            height: 3px

            top: 100%

            left: 0

            background: #347cdb

            transition: transform 0.5s

            transform: scaleX(0)

            transform-origin: right

        }

        ul li a:hover {

            color: #585858

            text-shadow: 0 0 10px #ccc

        }

        ul li a:hover::after {

            transform: scaleX(1)

            transform-origin: left

        }

    </style>

</head>

<body>

    <ul>

        <li><a href="#">home</a></li>

        <li><a href="#">archives</a></li>

        <li><a href="#">tags</a></li>

        <li><a href="#">categories</a></li>

        <li><a href="#">about</a></li>

    </ul>

</body>

</html>

我们常用cursor的小手属性,今天看了一篇技术文档,既惊且喜,发现了W3C上没有的属性。 首先罗列一下w3c上的cursor属性新发现的大陆 cursor:no-drop       //是一个红色的圈加一个斜杠,表示禁止的意思 cursor:not-allowed   //是一个红色的圈加一个斜杠,表示禁止的意思