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) 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
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. ;)
I recomment using the w3c validator http://validator.w3.org/. And no its not valid :-)
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.
TABLE
TBODY
THEAD
TFOOT
CAPTION
COL
COLGROUP
XHTML
tr
table
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>
<form>
block
<body>
<blockquote>
<noscript>
<map>
flow
<div>
<ins>
<del>
<dd>
<li>
<td>
<th>
It's not proper HTML, but it's sometimes done to lose the empty lines.