HTML表的位置低于它应该的位置

时间:2011-10-27 15:02:33

标签: c# asp.net html css

我有一个非常奇怪的HTML问题,我从未经历过。我一直试图解决它的问题,解决方案可能很简单!

要查看我的问题,请参阅以下图片: Visual image of problem

正如您所看到的,我的桌子位于用户控件下方200-300像素处,使用Navn和Besked,它不应该!它应该在下面。

现在,让我们看一下呈现的HTML代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>

</title>
<link href="Stylesheet/Styles.css" rel="stylesheet" type="text/css" /></head>
<body>
    <form name="aspnetForm" method="post" action="Forum.aspx" id="aspnetForm">
<div>
<input type="hidden" name="ctl00_toolkitScriptMaster_HiddenField" id="ctl00_toolkitScriptMaster_HiddenField" value="" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTIxNzE4MTg1D2QWAmYPZBYCAgMPZBYCAgEPZBYCAgEPZBYCZg9kFgICAw8WAh4LXyFJdGVtQ291bnQCDBYYZg9kFgJmDxUEAjEyMmRnZHNmZyBkZyBzZ2ZkIGdmcyBnZiBzZ2Ygc2RmZyBkZmcgc2ZnIHNmZyBzZGZnIHNkATATMjctMTAtMjAxMSAyMjo0MzowMGQCAg9kFgJmDxUEAjEzMmRnZHNmZyBkZyBzZ2ZkIGdmcyBnZiBzZ2Ygc2RmZyBkZmcgc2ZnIHNmZyBzZGZnIHNkATATMjctMTAtMjAxMSAyMjo0MzowMGQCBA9kFgJmDxUEAjExUEplZyBlciBoZWx0IHRvc3NldCBtZWQgc2lkZW4gLSBKZWcgZXIgaGVsdCB0b3NzZXQgbWVkIHNpZGVuIC0gSmVnIGVyIGhlbHQgdG9zc2V0ATATMjEtMTAtMjAxMSAxMjo1ODowMGQCBg9kFgJmDxUEAjEwFGdmZ2Znc2RmZ3NkZmcNCmZzZw0KATATMDctMTAtMjAxMSAxNDozNTowMGQCCA9kFgJmDxUEATkUSSBhbSB0ZXN0aW5nIGEgbG90IHIBMBMwNy0xMC0yMDExIDE0OjMyOjAwZAIKD2QWAmYPFQQBOApkZmZkc2ZzZGZkATETMDUtMTAtMjAxMSAxOToxMDowMGQCDA9kFgJmDxUEATcGa2tra2trATETMDUtMTAtMjAxMSAxOToxMjowMGQCDg9kFgJmDxUEATYGZ2dnZ3Z2ATETMDUtMTAtMjAxMSAxNjo1NTowMGQCEA9kFgJmDxUEATQUZ2FmZ2dmDQpnZGdzZA0KZ2RnZA0BMBMwNS0xMC0yMDExIDE1OjExOjAwZAISD2QWAmYPFQQBMxZmc2Fnc2ZnYWdzwqhmZ3NnZnPCqGdhATATMDUtMTAtMjAxMSAxNDo1ODowMGQCFA9kFgJmDxUEATIUZGduZGlndSBzZm5nc3VmZ2lkZg0BMBMwNS0xMC0yMDExIDE0OjM0OjAwZAIWD2QWAmYPFQQBMRRkZm1zaW4gZmdpdXNkIG5mZ2RzZwEwEzA1LTEwLTIwMTEgMTM6NTg6MDBkGAEFI2N0bDAwJENvbnRlbnRQbGFjZUhvbGRlcjEkTXVsdGlWaWV3Dw9kZmRxugsmEjuyu2Xbo8gslsOLZkR+JQ==" />
</div>

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>


<script src="/SubsiteClient/WebResource.axd?d=sMtxLdPlL48Rto8ujGKTrPMt4xS4q9IIukS7rw_b1-tVz_fuTpjK6WMO1fThkB6olwlijb7FXVNdBmSCc-lK1Shl0hg1&amp;t=634245478914809245" type="text/javascript"></script>


<script src="/SubsiteClient/ScriptResource.axd?d=NZ4L6OCv5Z3x50AgcnftYK7fWT6BUu-Gq9jE_2WxJYOCk37z40cpv_qqqs_kmnhvn-xJhbaCokNDxVy2NVY_RnuDRh65lmml8WfdO8As5iyIlncIhzm2AuDVtr7gMxdVp6sjIQ2&amp;t=3f0ccc7f" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
//]]>
</script>

<script src="/SubsiteClient/ScriptResource.axd?d=kpRlnyM1WRVy01WEn268dCfASwQAVa4jAV4Il9tdk3TTDVNPN4573gSvatDFGaS5ZYad71zPZWE4sKnE-uZR-VV1VI822qRI8oqDgu6i1yLz2_BW_AitLtFZycD6RCMLUEQCBA2&amp;t=3f0ccc7f" type="text/javascript"></script>
<div>

    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBAL339mjBQLWgqazCAKi/IGEDAL35sCPCXF2fOlt3NA/ZMTkI01Y4U+3xsAH" />
</div>
    <div class="BodyStyle">


            <a href="Default.aspx">Forsiden</a> 

                        <br /><br />
                 <hr />
  <h1>Hvad synes du om det nye</h1>






<b>Giv din mening om det nye</b><br /><br />
<span id="ctl00_ContentPlaceHolder1_GiveFeedbackControl1_StatusLabel" style="color:Red;"></span>

<p>(Evt. navn)<br />
    <input name="ctl00$ContentPlaceHolder1$GiveFeedbackControl1$NameBox" type="text" id="ctl00_ContentPlaceHolder1_GiveFeedbackControl1_NameBox" style="width:340px;" />
</p>

<p>Besked<br />
<textarea name="ctl00$ContentPlaceHolder1$GiveFeedbackControl1$FeedbackBox" rows="2" cols="20" id="ctl00_ContentPlaceHolder1_GiveFeedbackControl1_FeedbackBox" style="height:80px;width:340px;"></textarea>
</p>
<input type="submit" name="ctl00$ContentPlaceHolder1$GiveFeedbackControl1$GiveFeedbackBox" value="Giv feedback" id="ctl00_ContentPlaceHolder1_GiveFeedbackControl1_GiveFeedbackBox" />






             <table style="width:900px;">
                <tr> 
                    <td style="width:550px;"><b>Kommentar</b></td>
                    <td><b style="font-size:small;">Svar</b></td><td style="font-size:small; padding-left:7px;"><b>Sidste svar</b></td></tr>

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=12'>
                        dgdsfg dg sgfd gfs gf sgf sdfg dfg sfg sfg sdfg sd...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">0</td>
                    <td style="font-size:small; padding-left:7px;">27-10-2011 22:43:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=13'>
                        dgdsfg dg sgfd gfs gf sgf sdfg dfg sfg sfg sdfg sd...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">0</td>
                    <td style="font-size:small; padding-left:7px;">27-10-2011 22:43:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=11'>
                        Jeg er helt tosset med siden - Jeg er helt tosset med siden - Jeg er helt tosset...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">0</td>
                    <td style="font-size:small; padding-left:7px;">21-10-2011 12:58:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=10'>
                        gfgfgsdfgsdfg
fsg
...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">0</td>
                    <td style="font-size:small; padding-left:7px;">07-10-2011 14:35:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=9'>
                        I am testing a lot r...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">0</td>
                    <td style="font-size:small; padding-left:7px;">07-10-2011 14:32:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=8'>
                        dffdsfsdfd...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">1</td>
                    <td style="font-size:small; padding-left:7px;">05-10-2011 19:10:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=7'>
                        kkkkkk...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">1</td>
                    <td style="font-size:small; padding-left:7px;">05-10-2011 19:12:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=6'>
                        ggggvv...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">1</td>
                    <td style="font-size:small; padding-left:7px;">05-10-2011 16:55:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=4'>
                        gafggf
gdgsd
gdgd
...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">0</td>
                    <td style="font-size:small; padding-left:7px;">05-10-2011 15:11:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=3'>
                        fsagsfgags¨fgsgfs¨ga...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">0</td>
                    <td style="font-size:small; padding-left:7px;">05-10-2011 14:58:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=2'>
                        dgndigu sfngsufgidf
...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">0</td>
                    <td style="font-size:small; padding-left:7px;">05-10-2011 14:34:00
                    </td>
                    </tr>

                    <br />

                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=1'>
                        dfmsin fgiusd nfgdsg...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;">0</td>
                    <td style="font-size:small; padding-left:7px;">05-10-2011 13:58:00
                    </td>
                    </tr>


            </table>



    </div>
    <script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ctl00$toolkitScriptMaster', document.getElementById('aspnetForm'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>
</script>



<script type="text/javascript">
//<![CDATA[
(function() {var fn = function() {$get("ctl00_toolkitScriptMaster_HiddenField").value = '';Sys.Application.remove_init(fn);};Sys.Application.add_init(fn);})();Sys.Application.initialize();
//]]>
</script>
</form>
</body>
</html>

现在,我看不出这会给这个跨度。如果我们看一下标记:

<h1>Hvad synes du om det nye</h1>

    <asp:MultiView ID="MultiView" runat="server">

        <asp:View ID="SubCategoryView" runat="server">

            <uc1:GiveFeedbackControl ID="GiveFeedbackControl1" runat="server" />


             <table style="width:900px;">
                <tr> 
                    <td style="width:550px;"><b>Kommentar</b></td>
                    <td><b style="font-size:small;">Svar</b></td><td style="font-size:small; padding-left:7px;"><b>Sidste svar</b></td></tr>
            <asp:Repeater ID="EntriesRepeater" runat="server">
                <ItemTemplate>
                    <tr><td style="width:550px; border-right:1px dotted #000000;">
                    <a href='ForumReader.aspx?entryid=<%#DataBinder.Eval(Container.DataItem,"EntryId") %>'>
                        <%#DataBinder.Eval(Container.DataItem, "Title")%>...
                    </a></td>
                    <td style="font-size:small; border-right:1px dotted #000000; text-align:center;"><%#DataBinder.Eval(Container.DataItem, "GetNumberofReplies")%></td>
                    <td style="font-size:small; padding-left:7px;"><%#DataBinder.Eval(Container.DataItem, "GetEntryLastPost")%>
                    </td>
                    </tr>
                </ItemTemplate>

                <SeparatorTemplate>
                    <br />
                </SeparatorTemplate>
            </asp:Repeater>

            </table>
        </asp:View>
    </asp:MultiView>

对于那些想知道,用户控件没有一些神奇的低填充。

所以...世界上我在这里做得对吗? :-D

1 个答案:

答案 0 :(得分:1)

我认为这是由表格中形成错误的HTML引起的。

您的表格HTML包含&lt; br /&gt;行元素之间的标签。这不应该存在。它看起来像这样:

</tr>
<br />
<tr>

应该是这样的:

</tr>
<tr>

将您的整个代码发布到纯HTML文件中,我确实获得了额外的间距。删除表中的那些标签,它解决了问题。

我对APS并不熟悉,但我相信这是放置&lt; br /&gt;的代码。标签。尝试删除它:

<SeparatorTemplate>
    <br />
</SeparatorTemplate>

希望有所帮助!

干杯!