zoukankan      html  css  js  c++  java
  • placeholder的样式设置

    在input框中有时想将输入的字和placeholder设为不同的颜色或其它效果,这时就可以用以下代码来对placeholder进行样式设置了。

    ::-webkit-input-placeholder{}    /* 使用webkit内核的浏览器 */
    :-moz-placeholder{}                  /* Firefox版本4-18 */
    ::-moz-placeholder{}                  /* Firefox版本19+ */
    :-ms-input-placeholder{}           /* IE浏览器 */
    注1:冒号前写对应的input或textarea元素等。
    注2:placeholder属性是css3中新增加的属性,IE9和Opera12以下版本的CSS选择器均不支持占位文本。
    eg:
    css代码
     #input-test{
            color: #FFC0CB;
            font-size: 1.2em;
             180px;
            height: 36px;
    }
    #input-test::-webkit-input-placeholder{
            color: #ADD8E6;
    }
    #input-text::-moz-placeholder{ 
            color: #ADD8E6;        
    }
    #input-text:-ms-input-placeholder{
            color: #ADD8E6;        
    }
    html代码
    <div id="container">
        <input id="input-test" type="text" placeholder="修改placeholder样式" />
    </div>
    PS:除此之外,还能修改placeholder的font-weight等样式。

    -webkit-代表chrome、safari私有属性

    -moz-代表firefox浏览器私有属性
    -ms-代表IE浏览器私有属性

    -o-代表Operai私有属性

    转自:http://www.cnblogs.com/JennyLin77/p/5308431.html
  • 相关阅读:
    LeetCode-Cycle Detection,Find the Duplicate Number
    LeetCode-Symmetric Tree
    剑指offer-打印链表倒数第k个结点
    Http协议中Get和Post的区别
    ORDER BY 语句
    AND 和 OR 运算符
    WHERE 子句
    SQL SELECT DISTINCT 语句
    SQL SELECT 语句
    SQL DML 和 DDL
  • 原文地址:https://www.cnblogs.com/jvziking/p/7798353.html
Copyright © 2011-2022 走看看