美文网首页
CSS 实现必填项前/后添加红色星号

CSS 实现必填项前/后添加红色星号

作者: jesse28 | 来源:发表于2021-08-12 09:25 被阅读0次
    <!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>
    </head>
    
    <body>
    
        <style>
            .xrequired:before {
                content: '* ';
                color: red;
                vertical-align: middle;
                display: inline-block;
            }
        </style>
        <span class="xrequired">孙叫兽 : </span>
        <input type="text" value="" />
    
    </body>
    
    </html>
    

    相关文章

      网友评论

          本文标题:CSS 实现必填项前/后添加红色星号

          本文链接:https://www.haomeiwen.com/subject/fvnkbltx.html