apply external CSS to specific area

前端 未结 3 422
挽巷
挽巷 2021-01-18 05:17

I\'d like to import an external CSS (eg. Bootstrap) into my site-- the problem is I\'d like to apply the Bootstrap styles only to a specific region of the page. When I inclu

3条回答
  •  情话喂你
    2021-01-18 05:56

    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 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.

    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.

提交回复
热议问题