Tag Info

Hot answers tagged

6

I know exactly what you're looking for. While a debate about proper link tag usage and CSS storage folders is always a fun topic, realize none of that is your issue here. There are two components that allows you to add <link> tags to Page Layouts. First, you need to find the following lines of code in the head of the Page Layout's HTML page: ...


5

I'm sure there is room for improvement, but here is a working sample. jQuery(document).ready(function () { if(location.href.contains('&IsDlg=1')) { $(".ms-dialog td.ms-formbody > span > table > tbody > tr:first-child > td > span.ms-RadioText").each(function(){ //console.log('found the first ...


5

Try adding the path, as you have done in Name also, in After. Or since you have the css files directly in the 15, remove the path from the Name property. First option: <SharePoint:CssRegistration runat="server" ID="Custom2" Name="/_layouts/15/Custom2.css" After="/_layouts/15/Custom1.css" /> Second option <SharePoint:CssRegistration ...


5

This issue caused by angle brackets "<" to fix it replace it with "&lt" as below: <!--SPM:<SharePoint:CssRegistration name="&lt;% $SPUrl:~sitecollection/_catalogs/masterpage/css/style.css %&gt;" runat="server" />-->


5

I would advise against this...I would also advise against having an exact copy of the coreV4.css file. Having both these files is going to beef up the load times and increase the needless amount of code the browsers need to go through. Change your CSS registration to the following line. I also always add it after the CoreV4.css not that it makes a ...


4

I've also observed what you have; beyond ensuring that your CSS comes after core.css/corev4.css, the CSSRegistration.After property plainly doesn't work. I've extensively tested CssRegistration by using it to link 10 different CSS files into one user control, and it completely ignored the dependencies I specified. Furthermore, the ordering seems completely ...


4

As you say, there is no media attribute. There are a couple of ways I can think of to handle this in SharePoint: Either use Device Channels to target different master pages to different devices Or, add all of your responsive CSS to one file, containing the @media wrappers. This will also be better since if you for example resize your browser window, you ...


4

You have to change the file path like if you want to refer from 15 hive, <SharePoint:CssRegistration name="/_layouts/15/mycompany/develop/styles/style.css" runat="server" after="SharepointCssFile"/> It would not cause any issues if you refer it from 14 hive. But it would be better if you move it to 15 hive as all other stuffs related to Sharepoint ...


3

Thanks for Tiago for providing the solution. So here is the code if you want to move description up for Multiple lines of text. $("td.ms-formbody > span > textarea.ms-long").each(function(){ var descriptionElement = $(this).closest('.ms-formbody').contents().filter(function(){ return this.nodeType != 1; }); var descriptionText = ...


3

If you don't want to modify the master page, then the alternative is to go into Site Settings and click on Master Page in the look and feel section and in there add your custom css file into the Alternate CSS URL section.


3

try <SharePoint:CSSRegistration ID="CSSReg5" name="<%$SPUrl:~SiteCollection/Style Library/CSS/styles.css%>" After="corev4.css" runat="server"/> the part <%$SPUrl:~SiteCollection points to the root site collection, maybe your code is not pointing to that location! rather the site or sub site, method above explicitly says root site collection ...


3

Another method to add the CSS is to create the CssRegistration object in the C# codebehind for the web part, and add your instance of CssRegistration to the web part's control hierarchy using this.ChildControls.Add(). You'll need to ensure this code is done within CreateChildControls override of the web part.


3

To do this properly, leave corev4.css alone and define your own custom CSS file that includes only the CSS classes that you want to override. CSS loads in order so as long as your custom CSS is loaded after corev4, your styles will be applied. Since your new file includes only the CSS classes that were modified, it will also be much easier to manage than ...


3

URLs in CSS files are always relative to the CSS file itself. If you have assets to reference that are in the same (or close) location (for example, in Style Library or similar), you can simply use paths relative to the CSS file. If you are referencing assets from within _layouts or _layouts/images, that's just as easy. These are configured as virtual ...


2

If it is SharePoint List form, you can simply make the fields as Required and SharePoint will handle it... But if its some other form, which I think it is... you can use JavaScript like this: <script type="text/javascript"> function onSubmitValidation() { if (TrimAll(document.getElementById("field1").value) == "") { alert('All fields are ...


2

recently we had the same probleme with our site which should open in IE8 document mode. Whenever we set to display IE8 mode no changes! To fix this we had modified web.config file and added these lines <configuration> <system.webServer> <httpProtocol> <customHeaders> <clear /> <add ...


2

You can use ConditionalExpression property to specify your conditional browser version. For ex. <SharePoint:CSSRegistration name="/_layouts/solutionfolder/filename.css" After="corev4.css" ConditionalExpression="lt IE 7" runat="server" />


2

i dont think your doing it properly! <SharePoint:CssRegistration Name="<%$SPrl:~sitecollection/Style Library/MyCustomTheme/mycss.css%>" runat="server" After="corev15.css"/> you were doing "<% $SPUrl=~ instead of "<%$SPrl:~ http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.cssregistration.aspx EDIT try ...


1

If you just want to add custom CSS to a specific page, then add a Content Editor web part and point that to your CSS file.


1

It seems that the problem arise when your master pages are not located in the Master Page Gallery. The problem went away when I added the master page to the master page gallery and referenced it from there (i.e. _catalog/masterpage/mymasterpage.master) instead of the _layouts folder. The actual server deployment location of the master page is still in the ...


1

A very effective and easy way is to store the css files either in the file system or in the style library(I vote for the first one). First create a css file with the style definitions you want and save it in the structure in Visual Studio of a SharePoint Project. The files could either be copied to SharePoint root or to a SharePoint library on deployment. ...


1

If you don't want to edit master pages or page layouts I usually store the CSS in a document library (or asset library) on the same SharePoint site. Then I add content editor web part (CEWP) to the page to 'insert' this css into the page. Disadvantage is that you need to add that CEWP to every page where you want to apply the styling. I have once written ...


1

I have a lot of success adding CSS to a page by using the Script Editor web part (Found in Media and Content). Place the web part, edit it and copy your CSS link or the CSS itself and save the page. I have been using it to style some in-page controls for Excel Services Web Parts.


1

Place your CSS file under the master page gallery with the SharePoint designer (_catalogs/masterpage) On your master page file on the header zone call the CSS like the example bellow <SharePoint:CssRegistration name="<%$SPUrl:~sitecollection/_catalogs/masterpage/bindtuning.css%>" runat="server" after="SharepointCssFile" />


1

Possibly you set incorrect URL to your css file. You can try to see url using debug mode of a browser (usually you can press F12 for that) and then you could try to open this link directly in a browser window to see if it is accesible. Also you can take a look at a conversation about different places to keep CSS files. Maybe you find it useful.


1

Since you have packaged your branding elements including master page, css, images, js, etc into a feature (scoped to site), then I recommend that you activate this feature on each site collection (root site and sub site collections, i.e. yourdomain/sites/subsite1). The feature should include a module to transfer _catalogs/masterpage assets and at least ...


1

I believe the issue here requires clearing the issue of "root site collection vs other site collections" as each Site Collection in its own is an Isolation boundary, be it root or not. Basically the practice of deploying at Site Collection level (e.g. using Style Libraries) is a recomanded practice, and also it does follow the same isolation unit as the Site ...


1

OK. So if you have a directory structure like this: Folder1/ Folder1/images/image1.png Folder1/css/style.css (This can be inside any folder eg: _layouts, _layouts/1033/Styles etc) To refer to the image1.png from the style.css, all you have to do in the style.css is: '../images/image1.png' The "../" in the start will look for the images directory one ...


1

Why not deploy your CSS file to the Style Library. In this way you can update your CSS by uploading newer version of your css file directly to style library.


1

Yes, use the CssRegistration control to add your own CSS files. They are inserted into the page using the CssLink conrol in the masterpage. Hint: Use the After property to load your css file after a specific file, such as 'corev4.css'. This will let you define the load order of your CSS. You can insert your three instances of CssRegistration into a new ...



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