0

我在我的网站上创建了一个搜索功能。我想从 CSS 加载搜索按钮的图像。搜索功能有效,但按钮图像无法加载——为什么不呢?

这是我的表格:

<form>
<div id="form"><input value="/etn/pagetree" type="hidden" name="c" /> 
<input value="search" type="hidden" name="func" /> 
<input value="1148074" type="hidden" name="rid" /> 
<input onblur="if(value==''){value='Search'}" id="search_str" onfocus="if(value=='Search'){value='';}" value="Search" name="search_str" type="text" /><input id="search_btn" value=" " type="submit" name="Submit" /></div>
</form>

这是我的 CSS:

FORM { margin:0px; }

A, A:visited, A:hover { text-decoration:none; }

.subpages_box A, .subpages_box A:visited, .subpages_box A:hover { color:#ab0019; font-size:13px; font-weight:bold;  }

.footer_area A, .footer_area A:visited, .footer_area A:hover { color:#fec80c; }

a.sitemenu, a.sitemenu:visited { font-size:14px; color:#fff; padding:2 5 3 5; margin:2; line-height:170%; }
a.sitemenu:hover { background-color:transparent;}
#sitemenulit{ background-color:transparent; }

.map_box A, .map_box A:visited { color:#AB0019; }
.Xmap_box A:hover { color:#000; }

.lineOdd {
    BACKGROUND-COLOR: #e8e8e8
}
.lineEven {
    BACKGROUND-COLOR: #e8e8e8
}
.dropmenu A {
    PADDING-BOTTOM: 2px; PADDING-LEFT: 20px; PADDING-RIGHT: 10px;  COLOR: #443f3f; PADDING-TOP: 2px
}
.dropmenu A:visited {
    PADDING-BOTTOM: 2px; PADDING-LEFT: 20px; PADDING-RIGHT: 10px;  COLOR: #443f3f; PADDING-TOP: 2px
}
.dropmenu A:hover {
    BACKGROUND-COLOR: #901a6c; COLOR: #fff; TEXT-DECORATION: none
}


TABLE.search_box {
    WIDTH: 130px; MARGIN:8 50 0 0; float:right;
}
TABLE.search_box TD {
    TEXT-ALIGN: left; FONT-SIZE: 90%
}
TABLE.search_box #search_str {
    WIDTH: 94px;
    height: 21px;
    background: url(/wbn/slot/u3252/style/extbox.png) no-repeat;
    border: 0px solid transparent;
    padding: 3 2 0 5; font-size:11px;
}
TABLE.search_box #search_btn {
    WIDTH: 28px;
    height: 21px;
    background: url(/wbn/slot/u3252/style/btn.png) no-repeat;
    border: 0px solid transparent;
    cursor: pointer;
}

INPUT { margin:0px }

.content_area OL { margin:0px; padding-left:10px }

新编辑的代码

<table border="1">
<tbody>
<tr>
<td><form>
<div id="header"><input value="/etn/pagetree" type="hidden" name="c" /> <input value="search" type="hidden" name="func" /> <input value="1148074" type="hidden" name="rid" /> <input onblur="if(value==''){value='Search'}" id="search_str" onfocus="if(value=='Search'){value='';}" value="Search" name="search_str" type="text" /><input id="search_btn" value=" " type="submit" name="Submit" /></div>
</form></td>
</tr>
</tbody>
</table>
4

1 回答 1

1

Try this

input#search_str {
    WIDTH: 94px;
    height: 21px;
    background: url(/wbn/slot/u3252/style/extbox.png) no-repeat;
    border: 0px solid transparent;
    padding: 3 2 0 5; font-size:11px;
}
input#search_btn {
    WIDTH: 28px;
    height: 21px;
    background: url(/wbn/slot/u3252/style/btn.png) no-repeat;
    border: 0px solid transparent;
    cursor: pointer;
}

Look at how your elements are nested, in what div, class or id. There is something wrong with your CSS definitions. It's not good enough to build a website with an automated tool and then come and look for an answer here, you have to understand what you are doing...

于 2013-01-19T03:15:14.930 回答