美文网首页
非js实现input是否为空样式变化

非js实现input是否为空样式变化

作者: 羽晞yose | 来源:发表于2019-05-11 22:47 被阅读0次
模拟输入框
<input class="real-input" type="text" required>
<div class="model-input">请输入评论…</div>
    .model-input{
        .flex(ac);
        width: 670px/@p;
        height: 64px/@p;
        padding-left: 24px/@p;
        border-radius: 4px;
        color: #c8c8c8;
        font-size: 26px/@p;
        box-sizing: border-box;
        background: #f7f7f7;
    }
    .real-input{
        position: absolute;
        z-index: 1;
        top: 12px/@p;
        width: 670px/@p;
        height: 64px/@p;
        border: none;
        outline: none;
        color: #050c1c;
        background-color: transparent;
        &:focus+.model-input{
            opacity: 0;
        }
        &:valid+.model-input{
            opacity: 0;
        }
    }

相关文章

网友评论

      本文标题:非js实现input是否为空样式变化

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