Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
css布局问题将div放入td单元_Css_Html - Fatal编程技术网

css布局问题将div放入td单元

css布局问题将div放入td单元,css,html,Css,Html,我正在重新布置一个旧的asp页面,以便用一些新的要求对其进行更新。我试图在td单元内放置一些div标签,因为td单元内的表无法实现我所追求的目标。因此,基本上我有一个div,它应该与左上角对齐,另一个div也应该与顶部对齐,填充剩余的空间,一个div下面有一行文本,一个div下面有一个图像,应该水平和垂直居中,最后一个div位于图像下方,并与单元格底部对齐。我已经(见下面的代码)把它放在了IE中,但它在chrome和firefox中看起来像垃圾,我哪里做错了 <td style="posi

我正在重新布置一个旧的asp页面,以便用一些新的要求对其进行更新。我试图在td单元内放置一些div标签,因为td单元内的表无法实现我所追求的目标。因此,基本上我有一个div,它应该与左上角对齐,另一个div也应该与顶部对齐,填充剩余的空间,一个div下面有一行文本,一个div下面有一个图像,应该水平和垂直居中,最后一个div位于图像下方,并与单元格底部对齐。我已经(见下面的代码)把它放在了IE中,但它在chrome和firefox中看起来像垃圾,我哪里做错了

<td style="position:relative;">
                        <div style="position:absolute; width:10%; top:0; left:0;z-index:1;font-family:Verdana;font-size:small;color:#22476C;">
                            <%=(sCount+1) + ((pg-1)* PageSize)%>.)
                        </div>

                        <div style="position:absolute; width:100%; top:0; left:0%;z-index:2; text-align:center;">
                            <a style="font-family:Verdana;font-size:small;font-weight:bold;color:#22476C;" href="results.asp?pubid=<%=PubID & "&date=" & Server.URLEncode(w_RunDate) & "&ttype=" & tType%>" target="_top">
                                <%=rs("Publication")%>
                            </a>
                        </div>

                        <div style="margin-top:20px;text-align:center;font-family:Verdana;font-size:x-small;color:#22476C;">
                            <%=pubRunDate%>
                        </div>

                        <div style="text-align:center; vertical-align:middle;display:block;padding-bottom:120px;">
                            <img src="<%=LastThumb%>" style="border:solid 1px black;" alt="" />
                        </div>

                        <div style="position:absolute; left:0; bottom:0;" >
                            <table border="1" cellpadding="0" cellspacing="0" class="verdanaSmall" style="width:100%;background-color:#D3DAE1; vertical-align:bottom;">
                                <tr>
                                    <td style="width:32%;text-align:center;">
                                        <%=Replace(rs("Section"),"0","") & Fix(rs("Page")) & rs("Suffix")%>
                                    </td>
                                    <td style="width:68%;text-align:right; padding-right:10px;">
                                        <%=InvoiceString & " " & SaveString%>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align:right;">
                                        <%=w_Agency%>:&nbsp;
                                    </td>
                                    <td>
                                        <%=rs("AgencyName")%>
                                    </td>
                                </tr>
                                <tr>
                                    <%=RightCellA%>
                                </tr>
                                <tr>
                                    <td style="text-align:right;">
                                        <%=w_Advertiser%>:&nbsp;
                                    </td>
                                    <td>
                                        <%=rs("AdvertiserName")%>
                                    </td>
                                </tr>
                                <tr>
                                    <%=RightCellB%>
                                </tr>
                                <tr>
                                    <td style="text-align:right;">
                                        <%=w_Description%>:&nbsp;
                                    </td>
                                    <td>
                                        <%=Left(rs("Keyword"), 23)%>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align:right; padding-bottom:7px;">
                                        Size:&nbsp;
                                    </td>
                                    <%=RightCellC%>
                                </tr>
                            </table>

                        </div>
                    </td>

.)
“style=”边框:纯色1px黑色;“alt=”“/>
: 
: 
: 
尺寸:

我的假设是,在Mozilla中,您的填充和宽度%的计算方式不同,而且,有时Mozilla需要“display:inline block”,以便像IE一样显示DIV和a标记,而没有页面的实际示例

我强烈建议研究这两种浏览器解释CSS的方式的差异,特别是它们的填充/边距计算


最后一点-您正在将一个表嵌入到一个不符合W3C规范的表中。

您能用呈现的HTML替换您的ASP代码吗?这将使人们更容易深入了解您的示例并提供帮助。我相信区别是(或在任何情况下都是不同的)IE在计算宽度/高度时不包括填充和边距,而Firefox则包括填充/边距。但可能是另一种情况。在框模型上快速搜索应该会发现一些问题。编辑:我认为它们在处理边框时的行为与处理填充/边距时的行为相同。