积极答复者
江湖救急,页面中的元素不会按照“比例”显示,Why???

问题
-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BuildingMore.aspx.cs" Inherits="Web_MoreInfos_BuildingMore" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style=" height:100%">
<tr style=" height:1000px;">
<td style=" width:100%;height:100%;">
<object data="data:application/x-silverlight-2,"
type="application/x-silverlight-2" width="100%" style="height:100%;">
<param name="source" value="../../ClientBin/MyCharts.xap"/>
<param name="initparams" value="ChartType=BuildingModel1" />
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.60310.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="获取 Microsoft Silverlight" style="border-style:none"/>
</a>
</object>
</td>
</tr>
</table>
</form>
</body>
</html>问题:“Object”的高度设为“100%”了,但是并没有根据“<tr style=" height:1000px;">”设置的“1000px”的高度来显示,为什么呢???
“Object”引用的元素的高度是“100%”的,可以根据屏幕全屏显示的。
PS:
"Object"引用的“Silverlight页面”不论任何分辨率,都可以根据屏幕全屏显示。也就是说不论“Td”单元格的“高度和宽度”是多少,“Object”中的“Silverlight页面“都可以撑满单元格“Td”。
Science and technology is my lover.
答案
-
你好,出现这样结果的原因是你在你的 table 标签中指定了 style="height:100%" ,你可以设置 style="height:1000px",这样就不会上下有空白。以下是改正后的代码:
<body> <form id="form1" runat="server" style="height: 100%"> <table border="0" cellpadding="0" cellspacing="0" width="100%" style="height: 1000px"> <tr style="height: 1000px;"> <td style="width: 100%; height: 100%;"> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" style="height: 100%;"> <param name="source" value="ClientBin/SilverlightApplication1.xap" /> <%--<param name="initparams" value="ChartType=BuildingModel1" />--%> <param name="onError" value="onSilverlightError" /> <param name="background" value="white" /> <param name="minRuntimeVersion" value="4.0.60310.0" /> <param name="autoUpgrade" value="true" /> <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.0" style="text-decoration: none"> <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="获取 Microsoft Silverlight" style="border-style: none" /> </a> </object> </td> </tr> </table> </form> </body>
你也可以使用默认的 div ,在 div 标签内添加 style="height:1000px" 属性。- 已标记为答案 Johnson - MSFTModerator 2012年9月11日 7:11
全部回复
-
你好,出现这样结果的原因是你在你的 table 标签中指定了 style="height:100%" ,你可以设置 style="height:1000px",这样就不会上下有空白。以下是改正后的代码:
<body> <form id="form1" runat="server" style="height: 100%"> <table border="0" cellpadding="0" cellspacing="0" width="100%" style="height: 1000px"> <tr style="height: 1000px;"> <td style="width: 100%; height: 100%;"> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" style="height: 100%;"> <param name="source" value="ClientBin/SilverlightApplication1.xap" /> <%--<param name="initparams" value="ChartType=BuildingModel1" />--%> <param name="onError" value="onSilverlightError" /> <param name="background" value="white" /> <param name="minRuntimeVersion" value="4.0.60310.0" /> <param name="autoUpgrade" value="true" /> <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.0" style="text-decoration: none"> <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="获取 Microsoft Silverlight" style="border-style: none" /> </a> </object> </td> </tr> </table> </form> </body>
你也可以使用默认的 div ,在 div 标签内添加 style="height:1000px" 属性。- 已标记为答案 Johnson - MSFTModerator 2012年9月11日 7:11