duanmibei1929 2013-12-29 03:14
浏览 59

表格单元格内的文本框,周围没有边距

I would like to know how to put a textbox inside a table cell or <TD> and make it so the textbox's width and height is the same as the table cell so there's no visible margins or white space around the textbox.

I tried this on the website I'm trying to make but it messed things up, now my table doesn't have any borders visible. I'm just trying to make a php version of excel so my users can edit set/batch of records at once.

This is what my webpage shows:

enter image description here

and this is what I want to copy, the excel cell characteristic wherein there's no spaces between cells or if there is then make it very thin.

enter image description here

the code I have which may be affecting this is:

echo "<style type='text/css'>
.bordmargset{
 border:none;
 width:100%;
 height:100%;
}
</style>";

echo "<table border='1' style='width:100%; font-family:arial,Serif;font-style:regular;font-size:12px; color:black' CELLPADDING='0' CELLSPACING='0'>
<tr>
<th>Property Case</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zip Code</th>
<th>County</th>
<th>Price</th>
<th>Bed</th>
<th>Bath</th>
<th>Square Foot</th>
<th>Year Built</th>
<th>As Is Value</th>
<th>Hud Type</th>
<th>Main Type</th>
</tr>";

while($row = mysqli_fetch_array($result))
  {
  echo "<tr onclick='mclick(this)' onmouseover='mover(this)' onmouseout='mout(this)'>";
  echo "<td class='bordmargset'><input style='border:none;background-color:transparent;' type='text' value='" . $row['Property Case'] . "'></td>";
  echo "<td class='bordmargset'><input type='text' value='" . $row['Address'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['City'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['State'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['Zip Code'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['County'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['Price'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['Bed'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['Bath'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['Square Foot'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['Year Built'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['As Is Value'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['Hud Type'] . "'></td>";
  echo "<td style='border:0;padding:0;margin:0;'><input type='text' value='" . $row['Main Type'] . "'></td>";
  echo "</tr>";
  }
echo "</table><br>";
  • 写回答

1条回答 默认 最新

  • dongyan9838 2013-12-29 03:20
    关注
    <style type="text/css">
    .invisibletb{
     border:none;
     width:100%;
     height:100%;
    }
    </style>
    
    <table class="tftable" border="1">
    <tr><th>Invisible TextBox</th></tr>
    <tr><td><input type="text" class="invisibletb" /></td></tr>
    </table>
    

    Demo

    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?