I am trying to add some styling to a Sharepoint 2013 page using the Embed code facility. It works fine until I save the page and then it deleted all the text between the <style>
and </style>
tags?
So I click embed code on the page and enter the following
<style>
.sampleStyle {color:#fff}
</style>
When its saved and re-opened I find sharepoint has changed the code to this
<style unselectable="on">
</style>
In SharePoint 2013 a new feature is introduced called Embed Code. It inserts an embedded object, HTML snippets or scripts onto the page. This SharePoint new feature is located in the ribbon when the user edits the page. Create a new page and insert the HTML and CSS to edit the page and embed a code tab into the page. Click on the Insert Tab in ...
When you first add the code you must use in order for SharePoint to save and embed some code. Once it's embedded, you can change it and it will remain embedded and work.
When you first add the code you must use <script> in order for SharePoint to save and embed some code. Once it's embedded, you can change it and it will remain embedded and work. I think you can't add css styles and javascript in content editor. However, you can use script editor to add them.
Copy the embed code (if available) for the content you want to use. To do this, go to the site with the content you want to embed. Somewhere near the content you will typically see a Share button or link, or a button labeled Embed code or </>.
It can be done. In my frustration this morning, I was adding information in the embed code box and SharePoint wouldn't save it at all. When I returned to the box, it was just empty.
Here's how to make it work:
Use embed code as before, but enter the following:
<script type="text/css">
*/your CSS here/*
</script>
Click Insert
It'll now work!
When you first add the code you must use <script>
in order for SharePoint to save and embed some code. Once it's embedded, you can change it and it will remain embedded and work.
I think you can't add css styles and javascript in content editor. However, you can use script editor to add them.
Much better is to have a file and using script editor, include that file, like in video https://www.youtube.com/watch?v=gcWX3N4nWyw
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With