我想设置表的widthheightcllpaddingcellspacing以及有效性,但在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">&nbsp;</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>

visual studio中也不提供高宽valign top

最佳答案

如果您只想使用HTML来编写代码,可以这样做:

<table cellspacing="10px" cellpadding="10px" style = "height = 200px;width:200px;">

注意:cellspacing和cellpadding已经过时了,我认为在HTML5中是过时的,但是如果你尝试一下,它仍然可以工作(但也许你的编辑器会在Eclipse IDE上给你这样的警告信息)。在HTML标记中添加cssstyle在重新设计页面时既脏又难维护。
使用css:
    table { border-spacing: 5px;/*use to work like cellspacing */
      width : 200px;
      height:200px;
     }

    th, td { padding: 5px; } /*use to work like cellpadding */

关于c# - 我怎样才能在asp.net中给cellpadding,cellspacing一个表,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24845606/

10-10 22:04