【问题标题】:Wanna add Placeholder to input with the help of CSS3想在 CSS3 的帮助下将占位符添加到输入中
【发布时间】:2016-07-18 19:31:16
【问题描述】:

我知道在脚本的帮助下这是可能的。但是由于一些限制,我们可以在 css3 的帮助下完成。提前致谢

【问题讨论】:

    标签: css placeholder


    【解决方案1】:

    是的。有可能的。您可以使用以下示例。

    HTML 代码:

    <input type="text" value="" class="email_field"/>
    <label class="label">Email</label>
    

    CSS 代码:

    .email_field {
       width:95%;
       z-index:3;
       position:relative;
       background-color:transparent;
    }
    label {
       position:absolute;
       display:block;
       top:3px;
       left:4px;
       z-index:1;
    }
    

    【讨论】:

    • 您的要求是什么?
    • 我们可以用 css 将占位符添加到输入框中吗......就像任何修复一样,我们将不胜感激
    【解决方案2】:

    在输入中使用占位符属性

    <input type="text" placeholder="placeholder_text"/>
    

    【讨论】:

    • 哥们,我用 CSS 来询问它。我知道使用 html5 我们可以做到
    • 你没有告诉我你知道 html5,顺便说一句......我认为在 css3 中没有办法做到这一点
    猜你喜欢
    • 1970-01-01
    • 2016-05-15
    • 1970-01-01
    • 2021-10-28
    • 1970-01-01
    • 1970-01-01
    • 2017-07-13
    • 1970-01-01
    • 2015-09-18
    相关资源
    最近更新 更多