日期:2014-05-17  浏览次数:20742 次

我这个如何固定列宽并把表线变成兰
下面是我程序的代码,如何:
1,让这里的表格的最左列(一共就两列)的宽度固定死,不因内容改变宽度
2,如何让表格改成像CSDN这样的细兰线,它的固有表线很难看

  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
  <title>Repeater.DataSourceID Property Example</title>
  <style type="text/css">
  .style2
  {
  height: 30px;
  width: 313px;
  }
  .style3
  {
  width: 313px;
  }
  </style>
</head>

  <body>
  <form id="Form1" runat="server">

  <h3>Repeater.DataSourceID Property Example</h3>

  <asp:repeater id="Repeater1"  
  datasourceid="SqlDataSource1"
  runat="server">

  <headertemplate>

  </headertemplate>

  <itemtemplate>

  <table style="width:50%;" border="2">
  <tr>
  <td align="center" rowspan="3" valign="top" width="200">
  <%# Eval("id")%>
  <%# Eval("年级")%></td>
  <td class="style2" width="200">
  <%# Eval("教师姓名")%></td>
  </tr>
  <tr>
  <td class="style3">
  <%# Eval("文章")%></td>
  </tr>
  <tr>
  <td class="style3">
  <%# Eval("任课班级")%></td>
  </tr>
  </table>
  </itemtemplate>

  <footertemplate>

  </footertemplate>
  </asp:repeater>

  <asp:sqldatasource id="SqlDataSource1"  
  connectionstring="<%$ ConnectionStrings:kaoheConnectionString %>" 
  selectcommand="SELECT * FROM [fengong]"
  runat="server">
  </asp:sqldatasource>

  </form>  
  </body>
</html>


------解决方案--------------------
CSS code

table {
    table-layout:fixed;
    border-collapse: collapse;
}
table, td {
    border: 1px solid #0000FF;
}