I'm trying to use markup to create a Text node in an html document which does not affect the presentation and has no semantic meaning in order to get the :empty
pseudo-class to trigger.
Here's the code (copied from here):
th::after { content: attr(data-value) }
td::after { content: attr(data-value) }
td[data-value]:not(:empty) {
color: fuchsia;
}
<table>
<tr>
<th data-value="Peter"></th>
<td data-value="male">​</td>
<td data-value="34"></td>
</tr>
<tr>
<th data-value="Susanne"></th>
<td data-value="female"></td>
<td data-value="12"></td>
</tr>
<tr>
<th data-value="Lucas"></th>
<td data-value="male">​</td>
<td data-value="41"></td>
</tr>
</table>
After reviewing the Character Entity Reference Chart it's unclear to me if the ZeroWidthSpace
would be suitable for this purpose:
<td>​</td>
Is there a way to use html markup to create Text nodes without any semantic meaning?