Domanda

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

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top