Skip to content

Instantly share code, notes, and snippets.

@danawesome
Forked from wpsmith/sharepoint-style.css
Last active June 23, 2020 00:20
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danawesome/91cba156a096e8a60f85e2e521da6061 to your computer and use it in GitHub Desktop.
Save danawesome/91cba156a096e8a60f85e2e521da6061 to your computer and use it in GitHub Desktop.
CSS: Bootstrap fixes for SharePoint
/*bootstrap resets for SharePoint*/
/* the following might not be needed for you environment uncomment if needed*/
/*
#suiteBar *,
#suiteBar *:before,
#suiteBar *:after,
#s4-ribbonrow *,
#s4-ribbonrow *:before,
#s4-ribbonrow *:after {
-moz-box-sizing: content-box !important;
box-sizing: content-box !important;
}
*/
/* if the search no longer looks correct use the following */
.searchBox>.input-group,
.SearchBox>.input-group {
display:inherit;
position:inherit;
}
#scriptWPQ2 *,
#scriptWPQ2 *:before,
#scriptWPQ2 *:after {
-moz-box-sizing: border-box; /*border-box causes many issues with SP*/
box-sizing: border-box ; /* Needed for SharePoint 2013 */
}
#scriptWPQ2 * [class^="span"], #scriptWPQ2 * [class^="span"]:before, #scriptWPQ2 * [class^="span"]:after {
-moz-box-sizing: border-box;
}
img {
max-width: none;
width: auto;
}
body {
font-size: 13px !important; /* Needed for SharePoint 2013 */
}
* [class^="span"] img {
max-width: 100%; /*for images inside span grid*/
}
#scriptWPQ2 img,
img.ms-webpart-menuArrowImg,
#app img { /* changed #applist to #app */
width: auto; /*within a span may still need to have width of image not 100% for SP2013 OOTB features/imges*/
max-width: none;
}
.ms-siteactions-imgspan {
float: none;
margin: 0px;
}
#s4-ribbonrow [class*="span"] {
float: none;
margin-left: 0px;
line-height: 1.2em;
}
input.ms-cui-cb-input {
height: 14px;
padding: 3px 7px 2px;
}
select,
input[type="file"] {
height: auto;
line-height: 20px;
}
label {
display: inline-block;
margin-bottom: 0px;
}
/*end bootstrap resets*/
@danawesome
Copy link
Author

Revision 2 needed some fine tuning.

The goal is to have SharePoint look normal, but not lose bootstrap features in the Content Editor Web Part container '#scriptWPQ2'
Please note that if you have more than one webpart on the page the CEWP will have a different number, adjust accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment