如何完全删除CSS样式而不替换它?

时间:2023-01-23 20:36:41

I have a style given in the following way:

我有这样一种风格:

td,th{padding:0}

Now I want to completely remove this style dynamically and not override it with some value because I need the inline/default value set by the browser. Anyone having any idea how to do this, feel free to answer.

现在我想要动态地删除这个样式,而不是用某个值覆盖它,因为我需要浏览器设置的内联/默认值。任何知道怎么做的人,都可以回答。

2 个解决方案

#1


3  

In CSS 3, you might want to use

在CSS 3中,您可能想要使用。

th,td { padding: unset; }

or

th,td { padding: initial; }

http://www.sitepoint.com/css3-inheritance-tips-tricks/

http://www.sitepoint.com/css3-inheritance-tips-tricks/

http://www.w3.org/TR/css-cascade-3/#inherit-initial

http://www.w3.org/TR/css-cascade-3/ inherit-initial

#2


2  

Try making the value initial ie. Set the value to padding: initial

尝试将值设为ie的初始值。将值设置为:initial

#1


3  

In CSS 3, you might want to use

在CSS 3中,您可能想要使用。

th,td { padding: unset; }

or

th,td { padding: initial; }

http://www.sitepoint.com/css3-inheritance-tips-tricks/

http://www.sitepoint.com/css3-inheritance-tips-tricks/

http://www.w3.org/TR/css-cascade-3/#inherit-initial

http://www.w3.org/TR/css-cascade-3/ inherit-initial

#2


2  

Try making the value initial ie. Set the value to padding: initial

尝试将值设为ie的初始值。将值设置为:initial