我可以使用 :target
Can I use :target
在AMP Disallowed Styles中,他们说:
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
}
虽然AMP测试没问题,但是我对上面这样的CSS代码有疑问。我可以用吗?
我想可以使用 :target
标签,只要它不是以 amp-
开头,如 documentation you provided. This SO answer 中所述表明开发人员使用 :target
伪类.
#slide-in-menu {
transform: translateX(-100%);
transition: transform .2s ease-in-out;
... additional required styles ...
}
#slide-in-menu:target {
transform: translateX(0);
}
...:target
is much more effective and it works well for carousels too.
在AMP Disallowed Styles中,他们说:
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
}
虽然AMP测试没问题,但是我对上面这样的CSS代码有疑问。我可以用吗?
我想可以使用 :target
标签,只要它不是以 amp-
开头,如 documentation you provided. This SO answer 中所述表明开发人员使用 :target
伪类.
#slide-in-menu {
transform: translateX(-100%);
transition: transform .2s ease-in-out;
... additional required styles ...
}
#slide-in-menu:target {
transform: translateX(0);
}
...
:target
is much more effective and it works well for carousels too.