In CSS you need just :target (tr:target if you only want to highlight the table row and not other things with ID)
:target {
transition: background-color 1s ease-in;
-webkit-transition: background-color 1s ease-in;
-moz-transition: background-color 1s ease-in;
background-color: yellow;
}
If you want, you can use JavaScript to do it too
Assuming the ID matches the hash, add this to the head of your page
<script>
var srch = window.location.search;
document.querySelector(srch).style.background = "yellow";
</script>
Working Examples are here - note I had to set the var srch = "#namex";
in the examples because StackOverflow will have another hash value
var srch = "#namex"; // change to window.location.search;
document.querySelector(srch).style.background = "yellow";
<table>
<tr id="namex">
<td>namex</td>
<td>namex2</td>
</tr>
<tr id="namey">
<td>namey</td>
<td>namey2</td>
</tr>
</table>
Or this
var srch = "#namex"; // change to window.location.search;
document.querySelector(srch).classList.add("highlight")
.highlight {
transition: background-color 1s ease-in;
-webkit-transition: background-color 1s ease-in;
-moz-transition: background-color 1s ease-in;
background-color: yellow;
}
<table>
<tr id="namex">
<td>namex</td>
<td>namex2</td>
</tr>
<tr id="namey">
<td>namey</td>
<td>namey2</td>
</tr>
</table>