Reputation: 6105
Some elements like tr don't seem to support all the basic css properties. For example, as far as I can tell, doing something like:
<tr style="padding-top: 250px;">
has no effect. Can you please give me a good link for a site explaining allowed properties by element type? And if you have a comment on the above limitation please do share too.
Upvotes: 1
Views: 65
Reputation: 288100
You can search it in Mozilla Developer Network (MDN).
For example, from https://developer.mozilla.org/en-US/docs/Web/CSS/padding
Applies to: all elements except
table-row-group
,table-header-group
,table-footer-group
,table-row
,table-column-group
andtable-column
<tr>
is (by default) a table-row
, so padding
does nothing.
Note that it's not possible to make a list of allowed properties of each element type because allowed properties don't depend only on the element type.
For example, a <div>
with display:table-row
ignores padding
property (Demo).
Upvotes: 8
Reputation: 4896
You're supposed to put the padding-top
on the <td></td>
or <th>
element, not the <tr>
.
Block elements like <div>
support padding and margins, whereas inline elements such as <span>
do not.
<tr>
behaves like an inline element (though it technically isn't), and a padding can easily be added to a table row, once you replace your code with
<tr style="padding-top: 250px; display: block;">
or if you use
tr { display: block; }
Upvotes: 1