设置输入框背景

Jes*_*zie 7 css forms layout input

我必须创建一个具有以下背景的输入框

在此输入图像描述

到目前为止,在我的代码中,我有下面的代码并且没有显示 - >执行此操作的正确程序是什么?

我还要生成这个按钮的几个变体,它们是以下内容:

  • 按钮的黑暗区域上的十字架 - 我只是要使用<span>带有类的标签并将图形设置为 - >这是一个好方法吗?

  • 在左边的曲线后面的一个回形针图标 - >我将按照上面的相同做法 - >这是一个很好的方法吗?

HTML:

<div class="innerTo">
        <form action="#" method="get">
           <label for="recipients">TO: </label>
              <input type="search" name="recipients" id="recipients" placeholder="Recipients Names">
    </form>
    </div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.innerBar .innerTo{
    width:200px;
    padding:5px 0 0 15px;
    display:block;
    float:left;
}
.innerBar .innerTo label{
    margin:0 15px 0 0;
    font-size:14px;
    font-weight:bold;
    color:#666666;
}
.innerBar .innerTo input[type=search] {
    color: red;
}
.innerBar .recipients{
    background-image:url('../images/searchBGpng.png') no-repeat;
    width:192px;
    height:27px;
}
Run Code Online (Sandbox Code Playgroud)

o.v*_*.v. 10

摆弄:

<div class="input-container">
    <input type="text" value="aaaaaaaaaaaaaaaaaa"/>
</div>

.input-container {
    background: url(http://i.stack.imgur.com/0Vlc5.png) no-repeat;
    width:197px;
    height:28px;
}
.input-container input{
    height:28px;
    line-height:28px;/*results in nice text vertical alignment*/
    border:none;
    background:transparent;
    padding:0 10px;/*don't start input text directly from the edge*/
    width:148px;/*full width - grey on the side - 2*10px padding*/
}
Run Code Online (Sandbox Code Playgroud)

如果您计划以不同的宽度重复使用它,您应该查看滑动门技术.