Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
522 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...