首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >搜索焦点和输出

搜索焦点和输出
EN

Stack Overflow用户
提问于 2013-10-07 00:36:37
回答 1查看 44关注 0票数 0

所以我在做一个搜索栏,我想知道我会怎么做,所以当你点击搜索栏时,它会显示一个不同的图像,当你点击out,它会转到旧的图像。

CSS

代码语言:javascript
复制
/***** search form *****/
#search-form {
    padding:45px 10px 0 0;
    float:right;
}
#search-form fieldset {
    position:relative; 
    width:100%; 
    display:block; 
    overflow:hidden;
}
#search-form .search-field {
    float:right;
    width:300px;
    height:34px;
    background:url(../images/search-bg.jpg) 0 0 no-repeat; 
}
#search-form input {
    width:245px; 
    font-size:14px;
    line-height:1.25em;
    padding:9px 15px 9px; 
    font-family:Arial, Helvetica, sans-serif;
    background:none;
    border:none;
    margin:0;
    outline:none;
}
#search-form .search-button {
    display:block; 
    width:20px;
    height:21px;
    text-indent:-5000px;
    background:url(../images/search-icon.png) left top no-repeat;
    position:absolute;
    right:7px;
    top:7px;
}

代码语言:javascript
复制
<form id="search-form" method="post" enctype="multipart/form-data">
   <fieldset>
      <div class="search-field">
         <input name="search" id="searchFieldBox" type="text" value="" onfocus="fieldSwap('search-bg2.png')" >
         <a class="search-button" href="#" onClick="document.getElementById('search-form').submit()"></a>   
      </div>
   </fieldset>
</form>

现在我要编辑什么才能使这个工作

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-10-07 01:04:48

好吧,OP,我清除了CSS中以前的一些声明,以避免干扰添加的CSS,下面是我删除的声明:

代码语言:javascript
复制
#search-form input {background: none} and 
#search-form .search-field  {
   background:url(../images/search-bg.jpg) 0 0 no-repeat; 
}

以下是更新的jsFiddle -> http://jsfiddle.net/WXJGy/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19215576

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档