0

Large portions of the text I add to the site, I retrieve from different sources. This means that the text gets different fonts, size, etc. Thats a lot of work for me to manually change this.

I almost always use "edit source" when I insert text. The downside is that I have to insert all html tags, liks "", "

". But atleast the styling is correct.

What approach do you use? Is it possible to force via CSS that the font type, color, size etc. can not be changed

2 Answers 2

0

You can write css-styles with !important for the tags you need. But this probably isn't the cleanest way of doing things.

Alternative is to use the paste clean function and define your own text styles using a custom CSS link. Example below:

.ms-rteThemeFontFace-3{
    -ms-name: "Site Style";
    font-family: "segoe ui";
    font-size: 10pt;
    }

.ms-rteThemeFontFace-3 a:link{
-ms-name: "Site Style";
    text-decoration: underline;
    color: #ec0000;
    }

Load the css file into a library on your site (e.g. site assets) and get the link to the file; this can then be applied to the site via:

Site Settings > Look & Feel > Master Page> Alternate CSS URL> paste the link to your custom CSS file

(or use this at the end of your site URL /_layouts/15/ChangeSiteMasterPage.aspx)

This custom style will now be available through the Format Text menu in the ribbon, so you can apply it to all the text you've pasted in clean (with as much CSS customisation as you need) - and it will then be controllable centrally from your custom CSS file. So if you want to change it up, you only need to do it in one location.

2
  • If I create my own CSS, where do I need to upload/put it to be available in ribbon?
    – Drycker
    May 18, 2018 at 12:08
  • Updated with pathways/url
    – BoFellis
    May 18, 2018 at 12:37
0

You can write css-styles with !important for the tags you need.

Additionally you can write javascript code that will remove style, class attributes of DOM-elements in inserting content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.