请老师过目

来源:4-10 编程练习

qq_鸭绿桥第一帅哥_0

2019-03-14 12:31:53

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>b</title>
    <style type="text/css">
        .container{
            margin: 100px;
            position: relative;
        }
        input{
            border: 1px solid #999;
            outline: 0;
            width: 200px;
            height: 30px;
            line-height: 30px;
            text-indent: 50px;
            transition: all .3s;
            border-radius: 8px;
        }
        span.title{
            position: absolute;
            line-height: 30px;
            height: 30px;
            left: 2px;
            top: 2px;
            transition: all .3s;
        }
        input:focus,input:hover{
            text-indent: 2px;
        }
        input:focus+span.title,input:hover+span.title{
            transform: translate(-120%);
        }
        input:valid~label::after{
            content: "您输入的的邮箱正确";
        }
        input:invalid~label::after{
            content: "您输入的的邮箱错误";

        }
        input:valid{
            border: 1px solid green;
        }
        input:invalid{
            border: 1px solid red;
        }
    </style>
</head>

<body>
    <div class="container">
        <input type="email" id="mail" required placeholder="请输入邮箱">
        <span class="title">邮箱</span>
        <label for="mail"></label>
    </div>
</body>
</html>


写回答

1回答

好帮手慕星星

2019-03-14

你好,经测试代码实现的效果很好,很棒哦!

祝学习愉快!

0

0 学习 · 5012 问题

查看课程

相似问题

请老师过目

回答 2

请老师过目

回答 1

请老师过目

回答 1

请老师过目

回答 1

请老师过目

回答 1