SP2013: Hiding the ribbon in dialog view

Today I was working on a page which is displayed in a dialog view. Trimming SharePoint bits and pieces is easily done by adding IsDlg=1 to the querystring of the page. But… this does not hide the ribbon.

Ok, so how to hide the ribbon too then, when required? There’s a simple piece of CSS for that:

Suppose you add this snippet to a script editor web part which you added to your page. You save the page and… wait… how the heck  would you save the page without the ribbon? As soon as you save your code snippet, the CSS is inserted and the ribbon disappears. Now what?

Well… when you add IsDlg=1 to your page, this inserts CSS classes as well. Especially the “ms-dialog” class which is added to the HTML tag of your page. So make use of that and prefix your “hide the ribbon” CSS classes with it. This way, the ribbon will only be hidden in dialog view, and still usable in normal view.

Leave a Reply

Your email address will not be published. Required fields are marked *