Hot answers tagged

7

If you have deployed the CSS file to the Style Library or an Assets library, make sure it is checked in as a major version and approved. It could be possible that your page layout is not published and approved as well. This is the typical symptom when an asset is not approved, it works fine for admins but not general users.


7

You can put your script inside an EditModePanel control. Setting the PageDisplayMode property determines when it shows on the page. I use them for setting different CSS on a page layout during editing and they would be perfect in your scenario. Look at some of the OOTB page layouts for examples.


6

You would want to create an alternate css file. In it you would do .ms-pub-contentLayout { background-color: rgba(255, 255, 255, 1); } Save this css file in your site, then apply it using the Alternate CSS URL option in the MasterPage options, accessible via Site Settings, Master page, Alternate CSS section aka /_layouts/15/ChangeSiteMasterPage.aspx.


5

Add an id: <pre id="myId" .... And then hide it with jquery: addNewTest = function() { $('#myId').hide(); }); or without jquery: addNewTest = function() { document.getElementById('myId').style.display = 'none'; });


5

I guess you could always use a site collection token in your URL. ~sitecollection URLs and tokens in SharePoint 2013 If that don't work out for you, this blog post has a lot of great examples when working with masterpages and references. Use Site Url in SharePoint Update Try using a scriptlink instead. I'm unsure if encoding is needed thought. Try to ...


5

I have been using Mavention minifier tool. It is working as expected and you can apply this on the particular files that you wanted. MaventionMinifiedCssFileGenerator - for minifying CSS files MaventionMinifiedJsFileGenerator - for minifying JavaScript files MaventionObfuscatedJsFileGenerator - for minifying and obfuscating JavaScript files are the ...


5

easiest and best way for adding custom CSS is to add Alternate CSS URL from following web url in Central Administration Web App (port 3000 ) http://portal:3000/_layouts/15/ChangeSiteMasterPage.aspx Notes: first upload your css to below default and recommended location. you should already know that you can add this location to your windows mapped ...


5

You can use ~sitecollection instead of ~Site <SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/awesome.css %>" runat="server" /> For html master page, it will be: <!--SPM:<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/awesome.css %>" runat="server" />-->


4

You need the following piece of CSS to ensure that the menu items on the global navigation menus do not break into multiple lines and that the width of the drop-down menu extends to fit the length of the menu items' text: /* Disable menu text wrapping. */ #DeltaTopNavigation ul.dynamic { white-space: nowrap; word-wrap: normal; width: auto !important; ...


4

A ductape patch is adding a negative margin-top <div style="margin-top:-200px"> YOUR CONTENT </div>


4

You wanna target the specific webpart where you wanna change the link color, otherwise every link on the page will change font color. Use F12 Developer tools to find the ID of the specific webpart you wanna change the link text for. Insert the name/ID instead of my example (#WebPartWPQ5) and then use the CSS i provided below (SP2013). <style ...


4

Find id of that WP. Something like WebPartTitleWPQ4. Edit that page and insert script editor WP and add <style> <style> #WebPartTitleWPQ4 h2 { background-color: #000; color: #fff; } </style> EDIT Find where is title. For ex. <style> #WebPartTitleWPQ4 h2 { background-color: #000; } #WebPartTitleWPQ4 h2 span { ...


3

I would recommend adding a custom action to the web object at the root. The guys at pattern and practice explains it well Basically create a css file with what you need, put it somewhere and add the custom action using (var clientContext = new ClientContext(rootUrl)) { clientContext.Credentials = new SharePointOnlineCredentials(username, pwd); var ...


3

Most likely because your admin page has more content on the page thus pushing the footer down. You can fix the footer to the bottom with: footer { background: url('/_layouts/15/images/ForFarmers.Connect.Branding/bgfooter.png') right bottom no-repeat; z-index:100; position:fixed; bottom:0px; width: 100%; height: 160px; } But it will cover the ...


3

If you are only looking to affect things within the main content portion of the page (and not the page title bar, quicklaunch, etc.), on wiki pages all the content is in a div with an ID like ctl00_PlaceHolderMain_WikiField. Knowing that, you could set up your CSS selectors to always start with div[id$='WikiField'] so that you will only be targeting ...


3

How about using the WebEssentials Extension. Bundling and minifying is just one feature you would get out of it. Others are: A lot of compilers and linters for CSS/JS. Additional Debugging functionality Bundling via XML (CSS/JS/Sprites) Better Intellisense and a lot more just check their homepage Btw. these Tools are added in VS2015 by default and are ...


3

I would recommend to use the 'Alternate CSS URL' for adding custom CSS to a SharePoint Site. Go to Site Settings -> Master Page -> 'Alternate CSS Url'. Browse for the custom CSS file and save it. This adds the CSS to the site without any change to the master page.


3

Your first approach is the best way to add a custom css file to a master page. Backing up master page and then creating a custom master page, adding custom CSS file to Style Library and then adding external CSS link under <head> tag. These steps are the most recommended and considered as best approach. Just make sure to add the external css link just ...


3

Update an oslo.css is not recommendable approach because it can break other elements which you might not find even. You should check with developer tools about the CSS. Which CSS is breaking the layout and try to override that CSS with your custom CSS in the masterpage. Here is the great solution Responsive SharePoint available that you can use with ...


3

All content editors are rendered as part of single HTML document. CSS styles don't have scope, they affect entire page. It's a common practice to use content editors to hide SharePoint UI elements (like ribbon buttons) that are not part of the web part. You can create single root elements per each CE and assign ID value: <div id="navigation-div"> ...


3

You can put the code of loading external css file in JS only. Give it a try for below code: var cssId = 'myCss'; // you could encode the css path itself to generate id.. if (!document.getElementById(cssId)) { var head = document.getElementsByTagName('head')[0]; var link = document.createElement('link'); link.id = cssId; link.rel = ...


3

Most often there are no IDs. And hardcoding IDs (generated by SharePoint) in CSS rules will get you in trouble sometime in the future. When you add,(re)move other WebParts the IDs can change. Learn how to use CSS selectors to target with metadata used in other attributes. http://www.w3schools.com/cssref/css_selectors.asp Although not perfect, the ...


3

If you are using SharePoint, you have to live within the limitations that SharePoint gives you. One of those is the inability to name the divs. If you rename a DIV, then SharePoint won't know what to do with them. I do quite a bit of work on the client in SharePoint. If you can provide me with a use-case on why you feel you need to change the DIV name, ...


3

If you look at the screen capture above, you will see that the Web Part Title exists in a SPAN included in an H2 with the class ms-webpart-titleText. If you are using jQuery, you could do something like the code below to find the specific web part. var webpart; var webPartTitle = "Some Specific Web Part"; $("h2.ms-webpart-titleText").each(function() { ...


3

I've used that type of mega menu style before in a few sites. Here is a snippet of css below that I use to get those columns like in your example. It assumes you're starting with the default seatle master, so if you've got your own custom master you might need to edit some of the classes. #DeltaTopNavigation ul.static > li.dynamic-children > ...


2

Make sure both your master page and your css file are published and approved, so all users can see the update. Other users probably don't see the css file call because they are getting the previous version of the master page.


2

I tried it now in SharePoint 2013 and with SharePoint Designer. First you have to do the steps Amit described here: show-list-fields-side-by-side Open the site which contains the list in SharePoint Designer 2013. Select the List from List and Libraries section. Select your list. Under the forms section, click on New. On the popup, provide your form name ...


2

This has probably nothing to do with SharePoint. Are you sure you're using the last version of bootstrap ? I had the same issue one time, and I updated the fonts directory provided by bootstrap. Seemed like Chrome was having a problem with woff2 font files, I can't really remember. Edit : I remember now, it was a problem with IIS, I had to update my ...


2

First, unless that's a typo, it looks like you are missing a period between your class selectors, so it should be: #id .ms-vb2.ms-vb-lastCell But if the ID still isn't working, taking a quick look at a list view web part (in SP 2013, might be different in 2010, not sure what you are working in), it looks like the table has an attribute summary whose value ...


2

To fix the problem with the text getting out of the box, use the following solution: ul.dynamic { width: auto !important; white-space: nowrap; } Source: http://blog.sharepointexperience.com/2014/10/increase-width-sharepoint-drop-down-navigation/



Only top voted, non community-wiki answers of a minimum length are eligible