In the AMP Disallowed Styles, they say:
Pseudo-selectors, pseudo-classes and pseudo-elements are only allowed in selectors that contain tag names and those tag names must not start with amp-. Example OK: a:hover.
#thing:target {
some style
}
Although the AMP test is OK, I have a doubt about such above CSS code. Can I use it?