可以“移除” HTML元素的样式? [英] Is it possible to "remove" styling from HTML elements?

查看:151
本文介绍了可以“移除” HTML元素的样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用Javascript或其他方式将元素的样式恢复为默认状态。

I'm wondering if it's possible to restore an element's style to it's "default" state, with Javascript or otherwise.

我需要这样做, m将HTML插入第三方网页,无法控制它们属于不同元素的样式。例如,他们可能有:

I need to do this because I'm inserting HTML into 3rd party web pages and cannot control what styles they attribute to different elements. For instance, they may have:

div {
  margin: 10px;
  padding: 5px;
  line-height: 10px;
  font-size: 150%;
  border: 10px solid yellow;
  foo: bar;
}

有一个简单的方法来清除所有的样式,到默认设置?是否有默认样式列表?

Is there an easy way to clear out all of the styles and set it back to the "default" settings? Is there even a list of default styles?

感谢

推荐答案

似乎有人已经在SO上提出这个问题。

It appears that someone has already asked this question on SO.

CSS重置,公共元素的默认样式

这篇关于可以“移除” HTML元素的样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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