This might be long but I am facing some confusion about how Wordpress works and do not quite know the right search term to use in google to answer my query .In the pasts I have done web sites using HTML , CSS , JS and PHP . Since the last two months I have been learning about WP so that I can migrate the web site to Worpress . I think I understand what themes and plugins are and went through the code of some of the themes . Theme’s main functions seems to be en queuing all the scripts and styles, create the header ,footer , sidebar , create the blog index page template and some generic pages like archive , 404 etc templates .For individual pages themes seems to show the page content . However , what I fail to understand is if you have to code your own pages where do developers "put" in the HTML code in WP ? Like suppose for my website I have an Our Team Page and About US page whose HTML and CSS I have . What is the best place to put these HTML , CSS in Wordpress ? I understand most developers use Page Builders to do this but what if I want to hand code the pages ? There seems to be two ways to do this :
While creating the Page I can enter the HTML in HTML block of the editor and en queue the required CSS and JS by creating a plugin . The advantage is the content ( that is the HTML ) is actually stored in the database so I can change themes without affecting the content . However , somehow I have a feeling this is not how it is done in practice .
Making using of the template hierarchy . eg creating page-$slug.php and putting in the HTML code there . However , if I change my theme all the page content will go .
Could good people please tell me what is the best practice of coding these static pages in WP without using any page builders ? I feel I have not quite understood the basic idea behind Wordpress till I get this straight . I hope my question makes sense .