HTML,表格colspan问题

时间:2017-11-30 17:58:33

标签: html

我希望我的电子邮件,密码等与Name和Surname的宽度相同,但我正在努力解决这个问题。



<div id="container">
  <table>
    <tr>
      <td><input type="text" name="emer" placeholder="Emri"></td>
      <td><input type="text" name="mbiemer" placeholder="Mbiemri"></td>
    </tr>
    <tr>
      <td colspan="2"><input type="text" name="email" placeholder="Emaili"></td>
    </tr>
    <tr>
      <td colspan="2"><input type="password" name="email" placeholder="Password-i"></td>
    </tr>
    <tr>
      <td colspan="2"><input type="password" name="email" placeholder="Rivendos Password-in"></td>
    </tr>
  </table>
</div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

喜欢这个吗?

input元素宽度需要设置为100%才能获取容器的宽度!

td > input{
  width:100%;
}
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <div id="container">
        <table>
            <tr>
                <td><input type="text" name="emer" placeholder="Emri"></td>
                <td><input type="text" name="mbiemer" placeholder="Mbiemri"></td>
            </tr>
            <tr>
                <td colspan="2"><input type="text" name="email" placeholder="Emaili"></td>
            </tr>
            <tr>
                <td colspan="2"><input type="password" name="email" placeholder="Password-i"></td>
            </tr>
            <tr>
                <td colspan="2"><input type="password" name="email" placeholder="Rivendos Password-in"></td>
            </tr>
        </table>
    </div>
</body>
</html>