Nathan Kamenar
Nathan Kamenar

Reputation: 884

Bootstrap in sharepoint web part

Does anyone know of a good way to use Bootstrap styles for a SharePoint web part? I don't want to restyle the entire SharePoint site with bootstrap styles. I just want to be able to use bootstrap elements like buttons and forms and modals within a SharePoint web part without interfering with the regular SharePoint styles on the rest of the site. So with that in mind looking at the example below should give a good picture of what I want. Basically I want to reset the styles and then apply bootstrap styling within the div with ID BootstrapContent but everything outside of that div should be unaffected and just use the normal SharePoint styles. Thanks for the help.

<html>
 <body>
  STANDARD SHAREPOINT STYLES
  <div id='BootstrapContent'>
    HTML CONTENT WITH BOOTSTRAP STYLES
  </div>
  STANDARD SHAREPOINT STYLES
 </body>
</html>

Upvotes: 1

Views: 1892

Answers (1)

TimW
TimW

Reputation: 156

There's no good way to isolate one part of your html without using iFrames. If you went that way you could put your html into a doc lib, then call it from an iframe. That html file would reference bootstrap and only affect the iframe. You can use the Page Viewer web part to create the iframe for you.

Another option which isn't quite what you are asking, is you could get a cut down (customized) version of bootstrap customized. If you only need the grid system for example, only get that option. You might be able to exclude a lot of the generic things that interfere with SP. However, you'd likely lose things you want.

Upvotes: 1

Related Questions