Hope you're well;
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
I prefer add your code into html file and give reference to content editor webpart. In this way, HTML will not get messed up while you are editing the page for second time, also your code will be stored securely in one file. In accident if the page got deleted or content editor got deleted then all your changes will go away. So put your script, css, html in
.html file and give the link and see whether it is working or not.