0
我正在尝试构建一个Google即时型搜索栏,其中自动完成的文本为浅灰色。现在,我正在使用两种不同的表单输入来实现这一点(我相信Google也是这么做的)。我现在正在做,如下所示。尽管它起作用,但我觉得这肯定不是做这件事的恰当方法。任何人都可以提供更清洁的解决方案,因此这两个INPUT表单可以彼此重合吗?谢谢!重叠输入表单,我在CSS中正确执行此操作吗?
<form method="post" enctype="multipart/form-data" action="">
<input type="text" name="searchtext" id="searchtext" autocomplete="off" style="">
<input type="text" name="searchtextgrey" id="searchtextgrey" disabled="disabled"
autocomplete="off">
<input type="submit">
</form>
#searchtext {
position:relative;
background: transparent;
height:38px;
width:450px;
z-index:5;
background-repeat:no-repeat;
background-position: 257px 7px;
padding-left:5px;
padding-right:5px;
}
#searchtextgrey{
color: #e5e5e5;
position:absolute;
background: white;
height:38px;
width:450px;
z-index: 4;
overflow:hidden;
margin-left:-477px; //<---this can't be the best way to do it
padding-left:5px;
padding-right:5px;
}
你试过显示:无? – kalkin 2011-01-23 15:50:00