検索ボタンが絶対配置されたテキスト入力があります...ボタンのスペースを作るために、テキストがボタンの下に入らないようにパディングを使用しました。これは問題ありません。Firefoxでは機能しますが、IEでは機能しません。
実際...テキスト入力のパディングがIEでまったく機能していないようです。
彼らは次のコードを持っています
<style type="text/css">
#mainPageSearch input {
width: 162px;
padding: 2px 20px 2px 2px;
margin: 0;
font-size: 12px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
background:#F3F3F3 url(form-shadow.png) repeat-x scroll left top;
border-color:#C6C6C6 #C6C6C6 #E3E3E3;
border-style:solid;
border-width:1px;
color:#666666;
}
#mainPageSearch {
margin-bottom: 10px;
position: relative; /* Lets me absolute position the button */
}
#mainPageSearchButton {
display: block;
position: absolute;
top:0px;
right: -2px;
text-indent: -2000em;
height: 22px;
width: 22px;
background: transparent url('images/searchBtn.png') top center no-repeat;
}
</style>
<form id="mainPageSearch" action="">
<input type="text"/>
<a id="mainPageSearchButton" href="#">Search</a>
</form>
私がやろうとしていることは可能ですか、それとも検索ボタンの下にあるテキストを処理する必要がありますか?
透明な背景/境界線を持つ検索ボックスを作成し、それを含む div を使用してスタイルを描画できることはわかっていますが、サイトで変更する必要がある場所がいくつあるため、実際にはオプションではありません。
たぶん、このテキスト入力用の新しいクラスを作成して、それを透明にし、通常のテキスト入力スタイルをそれを含む div に割り当てますか? どう思いますか?
編集:申し訳ありませんが、Doctypeを含める必要がありました...ここにあります:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
また、私が抱えている問題はIE 7にあります