如何从元素中删除每个样式? [英] how to remove every style from element?

查看:114
本文介绍了如何从元素中删除每个样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过'remove'我的意思是重置所有可能在这样的元素下降的样式,并将其设置为浏览器默认值。

By 'remove' I mean resetting all the style that may descend on such element and put it to browser defaults.

我需要这个调试,知道什么规则正在造成伤害,我的东西好办法是删除所有的样式,然后逐个松开限制,以检查什么时候开始出错。

I need this for debug, I don't know what rule is causing harm and I thing good approach is to remove all styles and then loose the restriction one by one to check when things start to go wrong.

有您看到的网络上包含以下内容的任何片段:

Have you seen any snippets on the web that would consist of:

{ right: auto !important; left: auto !important; visibility: visible !important;...


推荐答案

你不能。在CSS3草稿中提出了 initial 的值,但即使它被定义,它也会将属性设置为CSS规范中定义的初始值,而不是由浏览器默认值定义。例如, display 属性的初始值为 inline ,但是确实浏览器不会将所有内容都渲染为内联元素默认情况下。

You cannot. There’s the value initial proposed in CSS3 drafts, but even if it were defined, it would set properties to the initial values defined in CSS specifications, not as defined by browser defaults. For example, the initial value of the display property is inline, but surely browsers don’t render everything as inline elements by default.

一个更好的方法是使用调试和检查工具,如Firebug或Web Developer Extension for Firefox。他们让你看到哪些样式适用于一个元素和它们来自哪里。

A better approach to your original problem is to use debugging and inspecting tools like Firebug or Web Developer Extension for Firefox. They let you see which styles apply to an element and where they come from.

这篇关于如何从元素中删除每个样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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