2011-02-10 22 views
0

テーブルを正しく表示しようとしています。固定幅を使用すると、テーブルは私が望むサイズになりますが、%を使用すると無視されるようです。asp:テーブル幅がパーセンテージで動作していません

<asp:Table ID="Times" runat="server" style="Width:100%;"> 
    <asp:TableRow BackColor="YellowGreen"> 
     <asp:TableCell Width="45%"> 
      <asp:Image ID="imgImage" runat="server" /> 
     </asp:TableCell> 
     <asp:TableCell Width="55%" >xxxxxx xxxx xxxx<br /><br /> 
     8:xxxxxxxx xxxxx xxxxxxxx<br /> 
     xxxxxxxxx x xxxx<br /> 
     xxxxxxx xxxxxxxxxx xxxxx</asp:TableCell> 
    </asp:TableRow> 
</asp:Table> 

は私が間違って何をやっている:ここで

は、コードのですか?

VS 2010、vb.net、.net4、asp.netアプリここ

がレンダリングされるマークアップです:

<table id="ContentPlaceHolder1_Times" style="Width:100%;"> 
<tr style="background-color:YellowGreen;"> 
    <td style="Width:45%"><img id="ContentPlaceHolder1_imgImage" src="Images\SlideShow\default\church.JPG" /></td><td style="Width:55%">Sunday Service Times<br /><br /> 
     8:45 Fellowship Time<br /> 
     9:00 Sunday School<br /> 
     10:15 Church Services</td> 
</tr> 

、ここでは、ASPXコードです。

<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" 
CodeFile="Default.aspx.vb" Inherits="_Default" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"> 
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> 
<asp:Table ID="Times" runat="server" Width="100%"> 
    <asp:TableRow BackColor="YellowGreen"> 
     <asp:TableCell Width="45%"> 
      <asp:Image ID="imgImage" runat="server" /> 
     </asp:TableCell> 
     <asp:TableCell Width="55%" >Sunday Service Times<br /><br /> 
     8:45 Fellowship Time<br /> 
     9:00 Sunday School<br /> 
     10:15 Church Services</asp:TableCell> 
    </asp:TableRow> 
</asp:Table> 
</asp:Content> 

マスターページ

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %> 


<!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> 
<asp:ContentPlaceHolder ID="head" runat="server"> 
</asp:ContentPlaceHolder> 
</head> 
<body background='<%=ResolveClientUrl("images\wood2.jpg")%>'> 
<form id="form1" runat="server"> 
<div id="header" style="padding: 5px 5px 2px; text-align: center; width: 400px;"> 
    <asp:Image ID="imgSCC" runat="server" ImageUrl="images\hdrpic.jpg" /> 
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" SiteMapProvider="Menu" 
     ShowStartingNode="false" /> 
    <asp:Menu ....> 
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> 
    </asp:ContentPlaceHolder> 
</div> 
</form> 
</body> 
</html> 
+1

私にはうまく見えます。それはすべてのブラウザで同じですか?それは別のテーブルまたはdivの中にありますか? – JumpingJezza

+0

私にもうまく見える... Firebugのようなものを使って、テーブルに適用されているすべてのスタイルを見ることができますか?または、正しく表示されていないものを示すスクリーンショットが含まれていますか? – davidsleeps

+0

テーブルコントロールの周りにaspxコードを追加してください。 – TheGeekYouNeed

答えて

1

は素晴らしい作品であればWidth="100%"代わりstyle="width=100%;"の(最終的には同じことを行い) どんな解像度あなたは固定幅がよさそうだと言ったときに参照されている

percentageは、ページをさまざまな解像度で正確に見せたい場合に適しています。

+0

私はそれを試して、テーブルが100%を占めていない。固定幅のために私は1024のためにそれを試みた – jvcoach23

関連する問題