Creating A Custom Table Row
I am trying to create a custom table row but having difficulty getting it to behave properly. I've tried the two below methods and they give bizarre results. I realize that this
Solution 1:
A <table>
element and its subcomponents <tbody>
, <tr>
require a very specific syntax. For example, only <tr>
elements are authorized as children of <tbody>
.
Therefore you cannot define a element and insert it in <tbody>
or <table>
. If you do that it will be moved outside of the <table>
at parsing. Hence the display of your first example (look the code in the Dev Tools).
Instead you should define a customized tag instead like in this answer to a similar question.
Or you should redefine a complete custom table structure with <custom-table>
, <custom-tbody>
... like in this other answer.
Also, you should use closing tag <custom-tr></custom-tr>
, and insert your CSS rule in the Shadow DOM if you want it to by applied inside it.
Post a Comment for "Creating A Custom Table Row"