When using the :target pseudo-class, it's important to note that it may not behave as expected. Additionally, it is impossible for a label to exist as a descendant of an input element in HTML, so any attempts to do so will not work as intended.
If you are looking to reference a label associated with an input through parentage or the for attribute, CSS3 does not provide a direct way to accomplish this. Instead, you can only target the label if it is a sibling that comes after the input element. You can achieve this using one of the following selectors:
input[type="text"]:focus + label
input[type="text"]:focus ~ label
If the label is located elsewhere in the DOM structure, such as an ancestor or preceding sibling, jQuery can be used to navigate the DOM and find the desired label.