我如何获得包含 class 名称的选择器

How can i get selector including class name

在html检查window中,我通常使用'copy Selector' 但这只会带来 <tag>s ,有时包括 .classname.

我想使用 'copy Selector' 在标签中包含所有类名。

我该怎么做?

只需在检查器中点击 新建样式规则 按钮(元素选项卡右上角的加号),它会生成包含 class 或 id 的样式规则并在某些情况下标记。然后你可以复制它生成的值。

您可以使用 Firefox 开发者工具
选择您的元素 -> 右键单击​​选择复制 -> CSS 路径

复制后结果:html body#gsr.hp.vasq.big div#viewport.ctr-p div#main.content span#body.ctr-p center div#lga img#hplogo