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.

  • you can add html & script in file. Then link it with your CEWP – Atish Dipongkor - MVP Nov 18 '15 at 3:49
  • I don't understand :( - In SharePoint Designer how to see/edit the script in a CEWP? – Mike Rooker Nov 18 '15 at 3:52
  • writing details in answer – Atish Dipongkor - MVP Nov 18 '15 at 3:54
  • did my explanation make sense to you? – Atish Dipongkor - MVP Nov 18 '15 at 6:05

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 -->

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.

  • 2
    name it CEWP.html instead of CEWP.tx then you can open the file in Designer. Note: This file will be under SharePoint source control... **so if you rename myStyle.js to something else.. SharePoint will rename the link inside CEWP.html for you.. **SharePoint IS Cool! – Danny '365CSI' Engelman Nov 18 '15 at 7:09
  • 1
    I am familiar with SharePoint source control. I found a problem in Standard version 6 months back that html does not render properly if I use .html. May be it is not there now. .tx was a typo. I meant .txt. Your comments/answers are also cool. I appreciate it always. – Atish Dipongkor - MVP Nov 18 '15 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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