<!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>
.email {
border: 1px solid #ddd;
outline: none;
}
.email:valid {
border: 1px solid #008c8c;
}
.email:invalid {
border: 1px solid #f00;
}
.email:valid + span::after {
content: '邮箱格式正确';
}
.email:invalid + span::after {
content: '邮箱格式不正确';
}
</style>
</head>
<body>
<input type="email" class="email">
<span></span>
</body>
</html>