Is OK to place a div inside th tag?
html
Solution
According to the HTML5 specification, that's absolutely fine. The content model is a normative description of what is allowed to be a child/descendant of the element. For the `<th>` element, only the following tags are permitted:
Content model:
Flow content, but with no header, footer, sectioning content, or heading content descendants, and if the th element is a sorting interface th element, no interactive content descendants.
The `<div>` tag is an example of flow content, so this should validate.
In the future, I'd like to recommend the W3C's validator service, which gives you a quick check to see whether your HTML is valid. In this instance, it passes:
<!DOCTYPE html>
<html>
<head><title> </title></head>
<body>
<table>
<tbody>
<tr>
<th>
<div></div>
</th>
</tr>
</tbody>
</table>
</body>
</html>
Problem
I didn't think this was a problem but my IDE seems to tell me otherwise. Are there any browsers that would fail to render this correctly? Using Netbeans IDE 7.3. Thanks.