在一个HTML表中,cellpadding并cellspacing可以设置是这样的:
<table cellspacing="1" cellpadding="1">
Run Code Online (Sandbox Code Playgroud)
如何使用CSS完成同样的工作?
我有一张桌子,上面有一个tr和2个tds.2 td有桌子.两个内表之间有空间,我不想要.有人可以建议我如何删除这个间距.这是我的标记:
<table style="border-spacing: 0; border-width: 0; padding: 0; border-width: 0;">
<tr>
<td>
<table width="100%" style="border-radius: 10px; border: 1px solid grey; width: 100%; border-collapse: initial;" id="Table1">
<tr>
<td>Subscriber Name: </td>
<td>
<input type="text" id="Text1" /></td>
</tr>
<tr>
<td>Subscriber Id: </td>
<td>
<input type="text" id="Text2" /></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" id="Button1" /></td>
</tr>
</table>
</td>
<td>
<table width="100%" style="border-radius: 10px; border: 1px solid grey; width: 100%; border-collapse: initial;" id="Table2">
<tr>
<td>Admin Name: </td>
<td>
<input type="text" id="Text3" /></td> …Run Code Online (Sandbox Code Playgroud) 有时候在xhtml中我们写的是假设<table border="1">,然后再写在我们编写的CSS中table{ border:2px solid black}.我很困惑什么时候写哪个.何时使用属性以及何时使用css.有时他们会感到困惑.