Question

I can add a script or CSS in a webpart via the broswer CEWP > HTML

But how do I do the same , what more modify a CEWP with script in it when I am in SPD 2010? I can't seem to figure it out nor can see the script in the CEWP because there id not HTML ribbon button.

Was it helpful?

Solution

The way, you are trying it does not sound good. You can try it in the following way.

  1. Add your css in separate file like myStyle.css
  2. Add your script in separate file like myScript.js
  3. Now create a text file like myCEWP.txt

Upload all the files in a assets library like Site Assets

Now open the text file and add css, js reference and also add other html.

<link href="/Site Assets/myStyle.css" rel="stylesheet" type="text/css">
<script src="/SiteAssets/myScript.js" type="text/javascript"></script>

<div >
    <!-- Write other html code here -->
</div>

Now link this myCEWP.txt file with your CEWP from browser.

enter image description here

Update: If you need this myCEWP.txt file under SharePoint Source Control, see the first comment by DannyEngelman. I found a problem in Standard version 6 months back. May be it is not there now.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top