如何复制由Web应用程序框架添加的无形嵌入CSS规则?

发布于 2025-02-12 08:54:10 字数 1039 浏览 0 评论 0原文

我的任务是转换A 网站,该网站似乎是通过Web应用程序框架构建的,为常规的HTML/CSS/JS网站。该网站可以访问在这里

该任务涉及重复现有的CSS规则。但是,我无法将所有嵌入式CSS规则复制为A< style>一次元素,因为它们对我来说是完全看不见的。

以元素.fjrkyu为例,Chrome DevTools表示该元素的CSS规则嵌入了A< style>元素。请参阅下图。

但是在我单击“< style>”之后为了查看所有其他CSS规则,检查员仅突出显示一个空样式>元素。其他CSS规则没有在哪里可以看到。请参阅下图。

我还尝试复制该>元素,但我得到的只是一个空的< style>其中没有CSS规则。

Firefox DevTools在其样式编辑器中显示了更多信息,并指出了< style>元素包含10个CSS规则。但是,这些CSS规则再也没有看到。

我需要复制所有这些嵌入式CSS规则以重复使用它们。尽管我可以通过一一检查所有元素来一一复制它们,但这很耗时,可能会错过其中的一些。一种复制A< style>的方法元素一次更可取。

I have been tasked with converting a website which appears to be built with a web application framework into a regular HTML/CSS/JS website. The website can be accessed here.

The task involves reusing the existing CSS rules. However, I'm unable to copy all embedded CSS rules in a <style> element at once because they are completely invisible to me.

Take an element .fjRKyu as an example, Chrome DevTools indicates that the element's CSS rule are embedded in a <style> element. Please see the figure below.

enter image description here

But after I click the "<style>" in order to see all other CSS rules, the inspector only highlights an empty <style> element. Other CSS rules are no where to be seen. Please see the figure below.

enter image description here

I also tried copying the outerHTML of that <style> element, but all I got is just an empty <style> element with no CSS rules in it.

Firefox DevTools shows a bit more information in its Style Editor and indicates that the <style> element contains 10 CSS rules. But again, those CSS rules are no where to be seen.

I need to copy all those embedded CSS rules in order to reuse them. Although I can copy them one by one by inspecting all elements one by one, that's time-consuming and can potentially miss some of them. A way for copying all CSS rules in a <style> element at once is more preferable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寻找我们的幸福 2025-02-19 08:54:10

这些规则是使用 insertrule api。

要将有效内容复制到剪贴板:

  1. 单击DevTools粘贴中的&lt; style&gt;元素
  2. ,然后在控制台中运行此代码:
copy(Array.from($0.sheet.cssRules, r => r.cssText).join('\n'))

您可以将此代码保存为 devtools摘要在Chrome中,并通过Ctrl-P快捷方式快速运行它。

These rules are generated programmatically using insertRule API.

To copy the effective contents to clipboard:

  1. click the <style> element in devtools
  2. paste and run this in console:
copy(Array.from($0.sheet.cssRules, r => r.cssText).join('\n'))

You can save this code as a devtools snippet in Chrome and run it quickly via Ctrl-P shortcut.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文