简体   繁体   English

获取仅特定html部分及其子元素的所有CSS

[英]Get all css of only a specific html part and its children

I want to get all style properties of a specific html part(div, form, table, ...) and its children. 我想获取特定html部件(div,表单,表格等)及其子元素的所有样式属性。 I know how to search for style of any page element, using any browser(chrome, firefox, etc..). 我知道如何使用任何浏览器(chrome,firefox等)搜索任何页面元素的样式。 Should I look one by one for its children to obtain all css? 我应该为孩子们逐一寻找所有CSS吗? Is there a way to get all css at one time related with an element and its children ? 有没有一种方法可以一次获得所有与元素及其子元素相关的css?

The easiest way to do this is to use the Computed Style tab in the Chrome or Firefox web inspectors as this will allow you to see not only the explicitly defined styles of the element(s) in question but will also show you inherited styles from the cascade. 最简单的方法是使用Chrome或Firefox Web检查器中的“计算样式”选项卡,因为它不仅使您可以查看所讨论元素的明确定义的样式,而且还可以显示从继承的样式。级联。

Otherwise you basically just need to copy ALL relevant style definitions from the element(s) and all of their parent and ancestor elements. 否则,您基本上只需要从元素以及它们的所有父元素和祖先元素复制所有相关的样式定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM