Switching Careers? its okay, you'll get it.
For you as a beginner, I'm about to share some tips that I've learnt in this short time that I've been in web development. The trick about writing codes, I have found over time is to continuously write codes, so as to have a lot of practice, do not relent, (could have taken this advice myself, but I didn't). You have to create projects, and not follow tutorials all the time. Of course tutorials are good, but over time you'll find out that everything you have done is according to the tutor, and you don't have the knowledge yourself. This could always bring about the feeling of unworthiness or unhappiness, and eventually, make you lose interest in writing codes all together.
To avoid this you have to create what you want, it could just be playing around with colors, adding padding and borders, creating forms, just simple things to help you learn.
As a beginner , you should also focus on growth , that is, focus on how better you're getting everyday, the new things you've learnt, instead of focusing on how good you are or how many languages you know.
I hope these few tips will help you learn codes faster and better, and also boost your interest in programming as a whole.