2

I'm getting white spaces at the top of my form and I believe I have tried everything but, it's still there. Can someone give some sugesstions at to how to get rid of the white space at the top? When I open the form in firefox it seems to be okay but, when I use IE I get white space. Also, it is a .cfm form. Thanks.

Here is my code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
.body
{
margin-top:0px;
padding-top:0px;
}
.mytable1
{
border-collapse:collapse;
border-color:#000000; 
border-style:solid; 
border-width:2px;
}
.mytable1 th
{
border-color:#333333;
border-style:solid; 
border-width:1px;
}
.mytable1 td
{
border-color:#333333;
border-style:solid; 
border-width:1px;
}
.mytable1
{
border-collapse:collapse;
border-color:#000000; 
border-style:solid; 
border-width:2px;
}
</style>
</head>

<body lang=EN-US style='tab-interval:.5in'>
<div id=Section1>
<cfoutput>

<form name="reportform" action="UpdateFormStatus.cfm" method="post">
<input type="hidden" name="UserEmail" value="#search_review.UserEmail#">
  <table class="mytable1">
    <tr>
      <td valign="top" class="blacktext" align="center" colspan="14"><strong>Review Form</strong></td>
    </tr>
    <tr>
      <td valign="top" class="blacktext" colspan="4"><strong>Type:</strong> #form.Type# </td>
      <td valign="top" class="blacktext" colspan="4"><strong>Number: </strong> #form.Number#   </td>         
    </tr>
    <cfif not search_results.RecordCount>
      <tr>
        <td class="blacktextbold" colspan="2"> No results match those criteria.</td>
         <td align="left" colspan="1"><a href="search_form.cfm">Search Again</a></td>
      </tr>
      <cfelse>
      <tr>
        <td valign="top" colspan="3" class="blacktext"><strong>Name:</strong> #form.Name# </td>
        <td valign="top" colspan="3" class="blacktext"><strong>Project Code: </strong> #form.ProjectCode# </td>
      </tr>
 </table>
</form>
</cfoutput>
</body>

</html>
4

5 回答 5

3

你已经body作为一个班级

应该是:

body{
margin-top:0px;
padding-top:0px;
}

对于您使用#的类的 ID .,如果您要定位一个像 div 这样的对象,您只需放置div

于 2013-04-15T13:22:41.423 回答
0

要从form元素中删除边距和填充,只需添加以下内容:

form
{
margin: 0px;
padding: 0px;
}
于 2013-04-15T14:24:01.210 回答
0

看起来您缺少cfif. 浏览器正在尝试修复您的 html 并将此标记放在表格上方。您也没有 div 的结束标签id="Section1"。CFML 与 HTML 不一样。由于 Cold Fusion 特定标签,这将无法正确呈现为 HTML。

于 2013-04-15T13:31:29.057 回答
0

您没有关闭父 div。 <div id="Section1"> 另外,正如@Andrew 提到的,您已body设置为一个类。(body {}而不是.body{})。

http://jsfiddle.net/fKMHe/

于 2013-04-15T14:23:17.270 回答
0

您应该将 html 的边距和填充也设置为 0 并删除 . 从正文选择器:

html, body
{
margin-top:0px;
padding-top:0px;
}
于 2013-04-15T13:23:01.483 回答