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