且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

覆盖父级的CSS显示属性

更新时间:2023-11-30 10:27:34

简答:不。

长回答:如果父级隐藏,则无法覆盖子级中的显示。您可以使用JavaScript从其父级中删除子范围,并将其放置在您可以应用显示样式的主体中。像显示,不透明度,可见性等的效果影响他们应用的元素的子元素,效果不能完全对抗,但对于像opacity这样的东西,他们可以添加到。

Long answer: There is no way to override display in children if the parent is hidden. You could use JavaScript to remove the child span from its parent, and place it in the body where you can apply a display style. Things like display, opacity, visibility etc, effect the children of elements they are applied to, the effects can't be completely countered, but for things like opacity they can be added to.