Hope you're well;
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.