Its happening because of your habit. These days most of the beginners have it. Which is copying and pasting.
Please try to avoid this habit. It wont help you. Only it will cost your time.
One solution from my side is, try to do the coding by yourself. Don’t copy past codes. Try to do the coding line by line by yourself. If you face any problem or get stuck somewhere, then research about it. Try to clear your basics first.
And one last thing, this field requires time to be a pro. Take your time & keep creating new thing yourself. If you don’t have the interest to create something new by yourself, then you cant learn it.
It will take time. You can watch my video tutorials about HTML & CSS to clear your basics.