使用Firebug在元素中获得CSS的深层副本 [英] Use Firebug to get a deep copy of CSS in elements

查看:139
本文介绍了使用Firebug在元素中获得CSS的深层副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Firebug检查网页的元素。在页面的右侧有一个样式选项卡,列出给定标记的所有CSS样式。这些CSS样式来自一个链接的CSS页面。



我想要做的是以某种方式复制一组带有硬编码的div的div。这样我可以复制和粘贴元素,具有完全相同的样式。这是可能与Firebug或其他工具吗?

解决方案

我不知道Firebug,脚本。



列出你想复制的CSS(你认为每一个属性都是为了使它可移植),然后在JS和 getComputedStyle()。然后构建属性:value 对的; 分隔列表,并将其分配给样式属性,如果你的元素和所有的孩子。



这看起来不是一个容易的任务 - 你毫无疑问会遇到问题。 / p>

I am using Firebug to inspect the elements of a webpage. On the right hand of the page there is a "style" tab that list all the CSS styling for a given tag. These CSS styling are coming from a linked CSS page.

What I am looking to do is somehow copy a set of divs with the CSS hardcoded in the div. This way I can copy and paste the elements and have the exact same styling. Is this possible to do with Firebug or perhaps another tool?

解决方案

I don't know about Firebug, but you could build a script to do it.

List the CSS you want to copy (every property you believe is required to make it portable) and then loop through in JS and getComputedStyle(). Then build a ; delimited list of property:value pairs, and assign it to the style attribute if your element and all children.

This doesn't look like an easy task - and you will no doubt run into problems.

这篇关于使用Firebug在元素中获得CSS的深层副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆