且构网

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

将外部CSS应用于特定区域

更新时间:2022-12-11 21:24:16

要做到这一点是有一个单独的iframe的内容,你想用Bootstrap风格(除非你想编辑Bootstrap CSS,并添加你的外部div的选择器到EVERY规则的开头)。

The only way to do this is to have a separate iframe for the content you want to style with Bootstrap (unless you want to edit the Bootstrap CSS, and add your outer div's selector to the beginning of EVERY rule).

HTML5引入了新的作用域属性,具体做了

HTML5 introduced the new scoped attribute, which is made specifically for your use case, but has not yet been implemented by any one of the major browsers.

如果你使用jQuery(你可能是,因为所有的Bootstrap的Javascript功能取决于jQuery),您可以尝试 Simon Madine的jQuery Scoped CSS插件

If you are using jQuery (which you probably are, since all of Bootstrap's Javascript functionality is dependent upon jQuery), you might wanna try Simon Madine's jQuery Scoped CSS plugin.