Html 表单标记在IE中创建不需要的换行符
我有一个使用谷歌定制搜索引擎的网页。我想让它更漂亮,所以我创建了一个环绕区域的包装器,基本上将搜索区域设置为一个圆角矩形。为此,我使用以下代码:Html 表单标记在IE中创建不需要的换行符,html,css,internet-explorer,Html,Css,Internet Explorer,我有一个使用谷歌定制搜索引擎的网页。我想让它更漂亮,所以我创建了一个环绕区域的包装器,基本上将搜索区域设置为一个圆角矩形。为此,我使用以下代码: <table style="height:33px;" border="0" cellpadding="0" cellspacing="0"> <tr> <td style="background-image:url(/leftEdge.png); height:33px; width:5px;">&am
<table style="height:33px;" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="background-image:url(/leftEdge.png); height:33px; width:5px;"> </td>
<td style="background-image:url(/bg.png); height:33px; background-repeat:repeat-x;">
<form name="cse" id="searchbox_demo" action="http://www.google.com/cse">
<input type="hidden" name="cref" value="" />
<input type="hidden" name="ie" value="utf-8" />
<input type="hidden" name="hl" value="" />
<input name="q" type="text" size="32" />
<input type="submit" name="sa" value="Search" />
</form>
<script type="text/javascript"
src="http://www.google.com/cse/tools/onthefly?form=searchbox_demo&lang="></script>
</td>
<td style="background-image:url(/rightEdge.png); height:33px; width:5px;"> </td>
</tr>
</table>
这段代码在Chrome中看起来不错。但是,在Internet Explorer中,右边缘图像显示在下一行。IE似乎正在添加换行符。然而,我不知道如何摆脱它。迄今为止,我已尝试:
- 将我的DocType更改为:
- 添加以下CSS:
表单{margin:0;padding:0;}
谢谢大家! 我不喜欢表格,所以我使用CSS和DIV重新制作了它:
<div style="height:33px; width:290px">
<div style="background-image:url(/leftEdge.png); height:33px; width:5px; float:left;margin:0; padding:0;"></div>
<div style="background-image:url(/rightEdge.png); height:33px; width:5px; float:right;margin:0; padding:0;"></div>
<div style="background-image:url(/bg.png); height:33px; background-repeat:repeat-x;margin:0; padding:0;">
<form name="cse" id="searchbox_demo" action="http://www.google.com/cse" style="margin:0; padding:0;">
<input type="hidden" name="cref" value="" style="margin:0; padding:0;" />
<input type="hidden" name="ie" value="utf-8" style="margin:0; padding:0;" />
<input type="hidden" name="hl" value="" style="margin:0; padding:0;" />
<input name="q" type="text" size="32" style="margin:0; padding:0;" />
<input type="submit" name="sa" value="Search" style="margin:0; padding:0;" />
</form>
<script type="text/javascript" src="http://www.google.com/cse/tools/onthefly?form=searchbox_demo&lang="></script>
</div>
</div>
它有点脏,但我希望它会有帮助。添加
表单{margin:0;padding:0;}
为我修复了它。你能不能制作一个小页面来演示这个问题,并发布整个代码?