4

I have a Share Point 2013 web site and a blog in it. Since my posts will include a lot of special text content, I need to add more styles that I will use on all posts. Typically all styles appear in the top ribbon bar when creating a new post.

Style selection

How to add the new style in Share Point Designer 2013? What do I need to do?

Andry
  • 16,172
  • 27
  • 138
  • 246

2 Answers2

4

What you are looking for are custom styles for the SharePoint RichText editor. The nice thing is that all you have to do is add some custom CSS and SharePoint will magically render new text styles. you can also do this with SharePoint Designer if you have a custom master page or if you just specify the alternate CSS somewhere.

The "magic" CSS is something like the following:

.ms-rteStyle-MySpecialStyle {
    -ms-name: "My special style";
    font-style: bold;
    color: red;
}
h2.ms-rteElement-SpecialHeading{
    -ms-name: "Special Heading";
    font-style: bold;
    color: green;
}

The difference between the two is the rteElement vs. rteStyles, but the difference becomes clear once you look at your screenshot: Page Elements and Text Styles. The difference is that you style particular elements with one, e.g. H1, H2, SPAN, and you style text passages with the other - SharePoint actually adds a span tag around the text and assigns it your style.

Enough of the words, a couple of complete blog articles to help you get started:

Community
  • 1
  • 1
Dennis G
  • 21,405
  • 19
  • 96
  • 133
  • Very nice answer... but I cannot find layout pages in my site... how can I add one? I had to put it in the master page.... – Andry Feb 28 '14 at 15:26
  • what do you mean by layout pages? as i mentioned in the answer the madter page is the right way to go or put it into the CustomCSS of your web – Dennis G Mar 02 '14 at 17:28
  • Yes sorry it is in the first link in the list of three links you provided... I went for the master page and it is ok, but I wnated to use a layoutpage as suggested by the first link... but can't create a layout page, maybe I should ask this into another question... – Andry Mar 03 '14 at 08:38
0

Please try this code for custom heading and text

h2.ms-rteStyle-customHeading
{-ms-name:"custom heading";
 color:gray;  }

.ms-rteElement-customTest 
-ms-name:"customize text";
{color:black; }
Kheema Pandey
  • 9,977
  • 4
  • 25
  • 26