SharePoint 2013: Inline Styles in Design Manager Page Layout

When you begin working with Page Layouts in SharePoint 2013 Design Manager available in Publishing site, you may want to start adding inline styles like you used to do in SharePoint 2010 to hide the left quick launch among many other reasons. Easy enough, you create a custom Page Layout in Design Manager, say named “Inline Page Layout”, and SharePoint creates two files for you, inline-page-layout.html and inline-page-layout.aspx. As we know, we are not supposed to touch the aspx file, only the html file. No problem.
Open the html file and in thesection we find a content placeholder,

 <!--MS:<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server">-->

Within this content placeholder, we wish to add our inline style to hide the quicklaunch menu.

<style type="text/css">
#sideNavBox {<br />
display: none;<br />
}<br />

But when you save the page layout, then load a page that uses this page layout in a browser you find that the left quick launch is still visible. Why?
Well, if you open the aspx file, in our case inline-page-layout.aspx in SPD (or Dreamweaver) you will see that within the PlaceHolderAdditionalPageHead Content Place Holder our inline style was converted to valid XML by SharePoint Design Manager and changed to:

<style type="text/css">
//<![CDATA[ #sideNavBox { display: none; } //]]><br />

Wow, that won’t work. Most browsers will see the CDATA block and ignore what is there, meaning that browsers will not process the included css. Well this one stumped me for a while, but I found a solution I like. Replace the entire original <style> tag in the HTML file with the following:

<style type="text/css">--><br />
<!-- #sideNavBox { display: none; --><br />
<!--ME: </style>-->

Save the HTML page layout and open the associated .aspx page. You should see:

<style type="text/css">
<!-- #sideNavBox { display: none; } --><br />

Perfect, that browsers can interpret. Nifty huh?
What we are doing is replacing the simple <style> tag with the new Design Manager Markup comment tagging. These Markup Start (MS) and Markup End (ME) tags allow us to pass any HTML/ tag directly to Design Manager without being converted to XML first. This allows us to send the inline styles to the associated .aspx untouched. I add the <!—and –> tags before and after the actual style properties only because in a HTML editor such as Dreamweaver, they will not see the <style> tag because it is in a Design Manager comment tag, so I want the editor to also ignore my inline style content. You actually do not need the <!—and –> if you plan to only work in a code view environment.
Have you found another solution to this problem? Please tell me.
See of all of my SharePoint 2013 Branding Tricks and Discoveries.

4 thoughts on “SharePoint 2013: Inline Styles in Design Manager Page Layout

  1. Panoone June 17, 2014

    Thank you! Lifesaving little tip.
    Knew there had to be a way to achieve such a stupidly simple need. 🙂

  2. Mike Rooker January 22, 2015

    You Sir are a scholar and gentleman.
    Thank you.
    NO one else seems to have had this gem/

  3. Patti December 14, 2015

    Great thanks!

  4. Jason May 16, 2017

    Every other post I can find wants you to do this through convoluted and complicated hacks, this is clean and simple!

Leave a Comment

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

Enter Code *

Filed Under


Anyone who has 'attended' a physical meeting by 'conferencing in' in knows the frustrations & limitations that come from not being in the room. You're the voice in the ceiling & not equally represented in the conversation.

This is no longer acceptable.

Today, we find ourselves facing the “hybrid work paradox.”

Employees are keen to retain flexibility. At the same time, human-to-human collaboration remains important.

To marry the best of both, hone your strategy, spaces, & tech to suit employee needs.

It's the day of the show, y'all!

Join the #PixelMillWebinars this morning at 11am PST for a live panel discussion about what the #digitalworkspace looks like for a #hybrid team, & how #Microsoft365 can empower your users no matter where they're working.


Join the #PixelMillWebinars this Thursday as we welcome key players from @OrchestrySoft, @KieferConsult, and @AP_Mortgage to discuss the hybrid work paradox and how #Microsoft365 can empower your users no matter where they're working.

We've all been itching to get "back to normal," but what does that mean? Are we missing out on valuable lessons learned by trying to return to something that perhaps wasn't working before?

Join us next week for a live panel discussion on the new normal.

Subscribe to PixelMill's

* indicates required

Let's Talk Digital
Workspaces Today

Get In Touch