HTML中怎样设置细线表格?

HTML中怎样设置细线表格?,第1张

<table border="1" cellspacing="0" >

<!--border=1设置包括标签table,tr,td的边框粗细,cellspacing合并标签tr,个td的空隙-->

<tr>

<td>1-1</td>

<td>1-2</td>

</tr>

<tr>

<td>2-1</td>

<td>2-2</td>

</tr>

</table>

您好!以下是最典型的细线表格,具备最基本的设置。供参考:

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>表格CSS设置</title>

<style>

#tb1 {

    border-collapse: collapse /* 折叠边框产生细线表格*/

    border: 2px solid black   /* 外框粗线、内部细线表格,表格线为黑色 */

}

#tb2 {

    border-collapse: collapse /* 折叠边框产生细线表格*/

    border: 1px solid red     /* 细线表格,表格线为红色 */

}

</style>

</head>

<body>

<br>

<table id="tb1" width="379" height="87" border="1" cellpadding="0" cellspacing="0">

  <tbody>

    <tr>

      <td width="123" height="34">&nbsp</td>

      <td width="122">&nbsp</td>

      <td width="126">&nbsp</td>

    </tr>

    <tr>

      <td height="25">&nbsp</td>

      <td>&nbsp</td>

      <td>&nbsp</td>

    </tr>

    <tr>

      <td>&nbsp</td>

      <td>&nbsp</td>

      <td>&nbsp</td>

    </tr>

  </tbody>

</table>

<br>

<table id="tb2" width="379" height="89" border="1" cellpadding="0" cellspacing="0">

  <tbody>

    <tr>

      <td width="123" height="36">&nbsp</td>

      <td width="122">&nbsp</td>

      <td width="126">&nbsp</td>

    </tr>

    <tr>

      <td height="25">&nbsp</td>

      <td>&nbsp</td>

      <td>&nbsp</td>

    </tr>

    <tr>

      <td>&nbsp</td>

      <td>&nbsp</td>

      <td>&nbsp</td>

    </tr>

  </tbody>

</table>

</body>

</html>

显示结果:

试试看

<!doctype html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Document</title>

</head>

<body>

<table cellpadding=0 cellspacing=0>

<tr>

<th>head1</th>

<td>content1</td>

</tr>

<tr>

<th>head2</th>

<td>content2</td>

</tr>

</table>

<style type="text/css">

table{

border: 1px solid black

}

th,td{

border: 1px solid black

}

</style>

</body>

</html>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/6096063.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-14
下一篇 2023-03-14

发表评论

登录后才能评论

评论列表(0条)

保存