Is a <form> valid over a ?

前端 未结 5 1669
夕颜
夕颜 2021-01-18 18:59

Is the following valid HTML? What I am wondering about specifically is the location of the

tag.

相关标签:
5条回答
  • 2021-01-18 19:12

    It's not valid. I'm guessing you want to remove the default padding of the form element. This is better done through CSS:

    form {
        padding:0;
        margin:0;
    }
    

    or

    <form style="padding:0;margin:0;">
    

    Your approach used to be very common to remove the default form padding (before CSS became popular). Now you should put the form tags outside the table. Preferrably you shouldn't even use a table here, but that's not the question, so I'll let it slide. ;)

    0 讨论(0)
  • 2021-01-18 19:13

    I recomment using the w3c validator http://validator.w3.org/. And no its not valid :-)

    0 讨论(0)
  • 2021-01-18 19:18

    No this is not valid, TABLE can only contain TBODY, THEAD, TFOOT, CAPTION, COL, COLGROUP. If you are using XHTML then you can also put tr inside the table.

    0 讨论(0)
  • 2021-01-18 19:18

    No. see: http://www.w3.org/TR/html4/struct/tables.html#edef-TABLE

    <!ELEMENT TABLE - -
     (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)> 
    

    The <form> element can appear in all places where you can have block content. So <form> can go in <body>,<blockquote>,<noscript> (oddly enough also in <map>). Because block can also go in flow, it may also appear in <div>,<ins>,<del>,<dd>,<li>,<td>,<th>

    0 讨论(0)
  • 2021-01-18 19:28

    It's not proper HTML, but it's sometimes done to lose the empty lines.

    0 讨论(0)
提交回复
热议问题