Is it valid to have a div inside of a <td> element? I need to display a box inside of the table..
Update:
I need this box (that appears in the td) to have padding..i.e. it really needs to look like a box thats floating in the middle of the td.
Is it valid to have a div inside of a <td> element? I need to display a box inside of the table..
Update:
I need this box (that appears in the td) to have padding..i.e. it really needs to look like a box thats floating in the middle of the td.
It is a question of semantic markup, yes you can have a div inside the td.
Valid? Perhaps. Good HTML? Maybe not.
Your best option, if you're already (stuck) using tables, is to put another table within the td.
Or you could just create the div inside the td and go on with your day, and not worry about it as long as it works.
A div element inside a td element is perfectly valid according to the XHTML 1.0 Strict DTD.
<!ELEMENT td %Flow;>
<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
<!ENTITY % block
"p | %heading; | div | %lists; | %blocktext; | fieldset | table">