2

As mentioned in the title, I'm currently facing the problem that something with/in Bootstrap might break the usual way of using custom fonts. I add <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> right in the beginning and <!-- Custom CSS Import --> <SharePoint:CssRegistration Name="<% $SPUrl:~sitecollection/_catalogs/masterpage/WTE/Styles/bootstrap.min.css %>" runat="server" /> <SharePoint:CssRegistration Name="<% $SPUrl:~sitecollection/_catalogs/masterpage/WTE/Styles/bootstrap-custom.css %>" runat="server" /> in the end of the part. Additionally

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script type="text/javascript" src="<asp:Literal runat='server' Text='<%$SPUrl:~sitecollection/_catalogs/masterpage/WTE/Scripts/jquery-3.3.1.min.js%>' />" ></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script type="text/javascript" src="<asp:Literal runat='server' Text='<%$SPUrl:~sitecollection/_catalogs/masterpage/WTE/Scripts/bootstrap.min.js%>' />" ></script>
<script type="text/javascript" src="<asp:Literal runat='server' Text='<%$SPUrl:~sitecollection/_catalogs/masterpage/WTE/Scripts/bootstrap-custom.js%>' />" ></script> 

is added right before the closing body tag. The rest is the simple seatle master page. What am I missing? In seatle master page alone it works just like a charm. So the font itself is ready to use and my spfont should be without any mistakes.

2 Answers 2

2

There are going to be quite a few things that do not look right with the layout once bootstrap is used in SharePoint. Make a custom CSS file and store it in the Style Library to override the some of the changes the bootstrap.css does and reference it in your code when you use bootstrap, or you can open the bootstrap.css file and make the modification you need to get it to play right with your master page. I use bootstrap in my farm and have had to do the same thing. Once you get it right though it is nice to have in your styling arsenal for SharePoint.

4
  • Well, I already disabled all font-settings in bootstrap.min.css just to be sure that this is not causing my problem at all. You may have any hint what might be another point to check?
    – airliner
    Commented Dec 12, 2018 at 15:20
  • 1
    You are just going to have to do some detective work on your own with the DEV toolbar. See what you need to do in order to get things to look right again. There are going to be a lot of !important clauses in your CSS I can tell you that. There is really no solid "this is how you do it" answer since every SharePoint farm is different. Just keep wacking the square peg into the round hole until it fits lol
    – lazoDev
    Commented Dec 12, 2018 at 15:38
  • 1
    I laughed harder than I should about your last comment. :D But seriously, I may found a bug with SharePoint 2016 onPrem regarding custom fonts w/ custom master pages. The stock Seatle masterpage works like a charm with fonts. I just downloaded and copied it under another name and the font is broken. The only way out was: Change the Look with Seatle and custom font and go to Site Settings >> Change Masterpage and set the custom masterpage there afterwards. Now both, font and masterpage, work together...
    – airliner
    Commented Dec 13, 2018 at 12:38
  • Nice! That is good to know. I will keep that in mind as well. Glad you were able to solve you problem!
    – lazoDev
    Commented Dec 13, 2018 at 12:47
2

@lazoDev said right things. Bootstrap has some things that is not working at all with SharePoint styles. Ex. body , html tags styles.
You can wrap your code to make it isolated to some css class.
Like in this question answers.
'.bootstrap-scope' is what you may search in this article. May be some styles you must be manully changing after scoping styles but such way you can use bootstrap.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.