简体   繁体   English

HTML 错误 表格行宽 2 列,小于第一行建立的列数 (3)

[英]HTML Error A table row was 2 columns wide, which is less than the column count established by the first row (3)

I am getting the same HTML error on the validator, if someone can help that would be wonderful.我在验证器上遇到相同的 HTML 错误,如果有人可以提供帮助,那就太好了。 I will put the code below.我会把代码放在下面。

    <section class = "blog container">
      <div class = "title">
         <h2>Donate</h2>
         <div>
            <h2>Donate</h2>
         </div>
      </div>
      <form id="donationInfo">
         <table class="center">
            <tr>
               <td><label for="title">Title:</label>
                  Mr.<input type="radio" name="title" tabindex="-1">
                  Mrs.<input type="radio" name="title">
                  Ms.<input type="radio" name="title">
                  Dr.<input type="radio" name="title">
               </td>
               <td><label for="fname">First Name:</label><input type="text" id="fname" tabindex="2" size="20" maxlength="20"></td>
               <td><label for="lname">Last Name:</label><input type="text" id="lname" tabindex="3" size="25" maxlength="20"></td>
            </tr>
            <tr>
               <td><label for="email">Email Address:</label><input type="email" id="email" tabindex="4" size="25"></td>
               <td><label for="date">Date:</label><input type="date" id="date" tabindex="5" size="25"></td>
            </tr>
            <tr>
               <td>
                  <label for="phonetype">Phone Type:</label>
                  <select id="phonetype">
                     <option value="C">Cell</option>
                     <option value="H">Home</option>
                     <option value="W">Work</option>
                     <option value="O">Other</option>
                  </select>
               <td><label for="telephone">Phone Number:</label><input type="tel" id="telephone" tabindex="7" size="25"></td>
            </tr>
            <tr>
               <td><label for="amount">Donation Amount:</label><input type="number" id="amount" tabindex="8"></td>
            </tr>
            <tr>
               <td><label for="ccNumber">Credit Card Number:</label><input type="text" id="ccNumber" tabindex="9" size="19"></td>
               <td><label for="security">Security Code:</label><input type="text" id="security" tabindex="10" size="4"></td>
               <td><label for="expiration">Expiration:</label><input type="text" id="expiration" tabindex="11" size="5"></td>
            </tr>
            <tr>
               <td>Agree to Terms:</td>
               <td>Yes <input type="checkbox" name="agreeYes" value="Yes" tabindex="12">
                   No <input type="checkbox" name="agreeNo" value="No" tabindex="13">
               </td>
            </tr>
         </table>
         <br/> 
      </form>
   </section>

Here is the picture of the warnings I am getting on the validator.这是我在验证器上收到的警告图片。 Thanks in advane for any and all help.感谢所有帮助。 在此处输入图片说明

You need to have the same number of columns in every row.您需要在每一行中具有相同数量的列。 Your first row ( <tr> ) contains 3 columns ( <td> ) - all next rows should have the same number (in general, it should be the biggest number throughout the entire table).您的第一行 ( <tr> ) 包含 3 列 ( <td> ) - 所有接下来的行都应该具有相同的数字(通常,它应该是整个表格中最大的数字)。

There are 2 ways to solve that:有2种方法可以解决:

  • add empty additional columns in every row在每一行中添加空的附加列
  • make the existed column to be wider by using colspan attribute .使用colspan属性使现有列更宽。 For instance, the next example例如,下一个例子

    <tr>
        <td>
            <label for="phonetype">Phone Type:</label>
            <select id="phonetype">
                <option value="C">Cell</option>
                <option value="H">Home</option>
                <option value="W">Work</option>
                <option value="O">Other</option>
            </select>
        </td>
        <td colspan="2"><label for="telephone">Phone Number:</label><input type="tel" id="telephone" tabindex="7" size="25">
        </td>
    </tr>

Also, make sure you closed all the tags, eg in 3d row, you don't close the first column另外,请确保关闭所有标签,例如在 3d 行中,不要关闭第一列

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 表格行的宽度为2列,小于第一行建立的列数(3) - A table row was 2 columns wide, which is less than the column count established by the first row (3) 表格行的宽度为1列,小于第一行建立的计数(4) - A table row was 1 columns wide, which is less than the count established by the 1st row(4) 表格行的宽度为2列,超过了第一行(1)建立的列数 - A table row was 2 columns wide and exceeded the column count established by the first row (1) 如何修复 W3 验证错误:表格行宽 X 列,超过了第一行 (X) 建立的列数 - How to fix W3 Validation error: A table row was X columns wide and exceeded the column count established by the first row (X) 复杂的HTML表无法验证:表行“超过了第一行建立的列数” - Complex HTML table not validating: table row “exceeded the column count established by the first row” HTML中有2列的表格; 第一列是7行,第二列是1行 - Table in HTML with 2 columns; first column is 7 rows, second column is 1 row 每行具有不同列数的 html 表 - html table with various column count in each row HTML表格中第一行和第一列之后的行 - Line after first row and column in HTML table 我如何在 html 中制作一个表格,第一行只有 1 列,其他行超过 1 - How do i make a table in html with first row having 1 column only and other rows having more than 1 选择HTML表的最后一行(tr)的所有列而不选择第一列(td) - Selecting all columns of last row (tr) of a HTML table without the first column (td)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM