在IE中使用元素的初始宽度不起作用 [英] use initial width for element not working in IE
问题描述
我有一个图形插件,它插入画布和一个图例< table>
到它的容器。在这个插件中,表
没有定义 width
,在我的CSS中,插件插入。
所以,新的div继承了 table {width:100%}
我试图使用 width:initial;
,在Chrome上看起来不错,但 https://developer.mozilla.org/en-US/docs/Web/CSS/initial?redirectlocale=en-US&redirectslug=CSS/initial\">IE不喜欢 检查浏览器兼容性
我承认在脚本/插件中更改/强制嵌入CSS,因为它必须在任何环境中工作。 / p>
这里最好的解决方案是什么?
一般 width:auto
会有类似的效果。有规则:
.my-selector {
width:auto;
width:initial;
}
应该使用初始
如果支持, auto
。
I have a graph plugin that inserts canvas and a legend <table>
to its container. In this plugin the table
has no width
defined and in my CSS there is a width for tables inside that container were my plugin gets inserted.
So, the new div is inheriting table{ width: 100%}
from the CSS and rendering wrong.
I tried to use width: initial;
, looks good on Chrome but IE doesn't like it check browser compatibility
I admit changing/forcing a inline CSS in the script/plugin since it has to work in any enviroment.
What is the best solution here?
Like you said, generally width: auto
will have a similar effect. Having the rules:
.my-selector {
width: auto;
width: initial;
}
Should cause it to use initial
if it's supported and auto
otherwise.
这篇关于在IE中使用元素的初始宽度不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!