我怎么能给cellpadding,cellspacing的一个表在asp.net
本文关键字:一个 net asp 怎么能 cellpadding cellspacing | 更新日期: 2023-09-27 18:13:54
我想设置width
, height
, cllpadding
和cellspacing
和表的对齐,但我没有在asp.Net中找到这些属性。(但是这些标签在PHP Dreamweaver中是可用的)指导我如何在asp.Net中为表设置这四个标签。我有visual studio 2012。
<table width="1332" height="231" border="1" >
<tr>
<td colspan="2" rowspan="2">Region</td>
<td height="21" colspan="3"><span id="result_box" lang="ar" xml:lang="ar">المجموع العام</span></td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2">مسندم</td>
<td colspan="2" rowspan="2"><span id="result_box2" lang="ar" xml:lang="ar">منطقة</span></td>
</tr>
<tr>
<td height="23" colspan="3">Grand Total</td>
<td colspan="2"> </td>
<td colspan="2">Musandam</td>
<td colspan="2">Al-wusta</td>
<td colspan="2">Alburaimi</td>
<td colspan="2">Al-Dhahira</td>
<td colspan="2">Dohfar</td>
<td colspan="2">Al-dhakhila</td>
<td colspan="2">Al-sharqiya(n)</td>
<td colspan="2">Al-sharqiyah</td>
<td colspan="2">Albatiniah(s)</td>
<td colspan="2">Al-Albatinah</td>
<td colspan="2">Muscat</td>
</tr>
<tr>
<td colspan="2">Gender</td>
<td width="77"><span id="result_box8" lang="ar" xml:lang="ar">مجموع</span></td>
<td width="24">١</td>
<td width="24">ذ</td>
<td width="10">١</td>
<td width="14">ذ</td>
<td width="45">١</td>
<td width="16">ذ</td>
<td width="11">١</td>
<td width="34">ذ</td>
<td width="13">١</td>
<td width="39">ذ</td>
<td width="25">١</td>
<td width="32">ذ</td>
<td width="16">١</td>
<td width="20">ذ</td>
<td width="28">١</td>
<td width="32">ذ</td>
<td width="28">١</td>
<td width="49">ذ</td>
<td width="42">١</td>
<td width="25">ذ</td>
<td width="26">١</td>
<td width="44">ذ</td>
<td width="38">١</td>
<td width="29">ذ</td>
<td width="22">١</td>
<td width="17">ذ</td>
<td colspan="2"><span id="result_box3" lang="ar" xml:lang="ar">جنس</span></td>
</tr>
<tr>
<td colspan="2">Specialization</td>
<td>Total</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td>F</td>
<td>M</td>
<td colspan="2"><span id="result_box4" lang="ar" xml:lang="ar">تخصص</span></td>
</tr>
<tr>
<td width="68" rowspan="4" valign="top">Foundation</td>
<td width="152" valign="top">Engnieering</td>
<td height="23">120</td>
<td>48</td>
<td>72</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td width="105" valign="top">الهندسة</td>
<td width="37" rowspan="4" valign="top">مؤسسة</td>
</tr>
<tr>
<td valign="top">Information Technology</td>
<td>213</td>
<td>147</td>
<td>66</td>
<td>1</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td valign="top">تكنولوجيا المعلومات</td>
</tr>
<tr>
<td rowspan="2" valign="top">Total</td>
<td rowspan="2">313</td>
<td height="28">195</td>
<td>138</td>
<td>1</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td rowspan="2" valign="top">إجمالي</td>
</tr>
<tr>
<td height="26" colspan="2">313</td>
<td colspan="2">3</td>
<td colspan="2">0</td>
<td colspan="2">4</td>
<td colspan="2">0</td>
<td colspan="2">4</td>
<td colspan="2">0</td>
<td colspan="2">4</td>
<td colspan="2">0</td>
<td colspan="2">4</td>
<td colspan="2">0</td>
<td colspan="2">4</td>
<td colspan="2">0</td>
</tr>
</table>
Height width valign top在visual studio中也不可用
如果您只想使用HTML编码,则可以这样做:
<table cellspacing="10px" cellpadding="10px" style = "height = 200px;width:200px;">
注意:cellspacing和cellpadding是过时的,我认为在HTML5中,但如果你给它一个尝试,它仍然工作(但也许你的编辑器会给你警告信息,就像在Eclipse IDE)。在你的HTML标签中添加css style
是肮脏的,很难维护,当它涉及到重新设计你的页面。
使用css:
table { border-spacing: 5px;/*use to work like cellspacing */
width : 200px;
height:200px;
}
th, td { padding: 5px; } /*use to work like cellpadding */
在Visual Studio中为表格添加一个类,并在CSS中应用它,如下所示。例如,我要分配类mycuststyle
。
table.mycuststyle
{
border-spacing:3px;
width:400px;
height:400px;
}
table.mycuststyle td, table.mycuststyle th
{
padding:10px;
vertical-align:middle;
text-align:left;
}
<html>
<head>
<title>Cell Spacing & Cell Padding</title>
</head>
<Body>
<table border="border">
<tr>
<th colspan="2">Cuisine</th>
</tr>
<tr>
<th>Non Veg</th>
<th>Veg</th>
</tr>
<tr>
<td>
<table border="border">
<tr>
<th> </th>
<th>Fish</th>
<th>Chicken</th>
</tr>
<tr>
<th>Cost</th>
<td>450 </td>
<td>550</td>
</tr>
</table>
<table border="border">
<tr>
<th>Idli</th>
<th>Dosa</th>
</tr>
<tr>
<td>35</td>
<td>40</td>
</tr>
</table>
</td>
</tr>
</table>
</Body>
</html>