gpt4 book ai didi

html - 搜索框不工作

转载 作者:行者123 更新时间:2023-11-28 14:35:09 25 4
gpt4 key购买 nike

我想实现主菜单在左边、搜索框在右边的栏。我的代码是:

  <div id="divMenu">
<div id="menu">
<ul>
<li><a href="index.html" class="active"><span>Home</span></a></li>
<li><a href="#"><span>About Us</span></a></li>
<li><a href="#"><span>Events/Services</span></a>
<ul>
<li><a href="#"><span>submenu1</span></a></li>
<li><a href="#"><span>submenu2</span></a></li>
<li><a href="#"><span>submenu3</span></a></li>
</ul>
</li>
<li><a href="#"><span>Ventures</span></a></li>
<li><a href="#"><span>Testimonials</span></a></li>
<li><a href="#"><span>Resources</span></a></li>
<li><a href="#"><span>e-Commerce</span></a></li>
<li><a href="#"><span>Contact Us</span></a></li>
</ul>
</div>
<div id="search">
<!--<form id="fmSearch" name="fmSearch" method="post" action="">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="iSearch" type="text" id="iSearch" value="Search..." size="20" maxlength="100" /></td>
<td><input id="bSearch" name="bSearch" type="image" src="images/search.gif" class="button" /></td>
</tr>
</table>
</form>-->
<form id="fmSearch" name="fmSearch" method="post" action="">
<label><span>
<input id="iSearch" name="iSearch" type="text" class="keywords" maxlength="50" value="Search..." />
</span>
<input name="b" type="image" src="images/search.gif" class="button" />
</label>
</form>
</div>
</div>

CSS 样式是:

#divMenu { width:100%; height:30px; background-image:url(../images/bar_menu.jpg); background-repeat:repeat-x; margin:0; padding:0; border-top:1px solid #999;}
#menu { width:75%; margin:0; padding:0; height:30px; position:absolute;}
#menu ul {float:left; margin:0; padding:0; list-style:none; font-size:0.8em;}
#menu ul li {float:left; margin:0; padding:0;}
#menu ul li a {line-height:25px; display: block; color:#fff; padding:2px 10px; text-decoration:none; z-index:500;}
#menu a:hover, #menu ul li a.active {margin:0; /*background-image: url(../images/img_nav.jpg);*/ background-color:#1D1D1D; background-repeat:repeat-x; z-index:510; color:#999;}
#menu ul li ul {display:none; position:absolute; background-color:#333; z-index:520; font-size:1em;}
#menu ul li:hover ul {display:block; z-index:530;}
#search { width:25%; padding:0; margin:0; float:right; height:30px; z-index:999;}
#search form #iSearch { height:16px; z-index:1000;}

问题:我的搜索框不工作。它显示在页面上,但无法单击它并输入它,就好像它被隐藏在某些东西下面一样。

有什么建议吗?

最佳答案

这里一切正常

http://jsfiddle.net/XFse7/

一定是之前的一些 CSS 导致了问题。如果它对您不利,我认为它在您的菜单下。并注意 z-index 仅适用于定位标签

position:absolute、相对、固定等...

关于html - 搜索框不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6839134/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com