Always write code that simple to read and which will be understandable for developers. It will save alot of time for revisions.
Structure First.
Before writing the first line of the code, you should understand what it will be doing, what it will use, what structure will it have and how to make adjustments.
Code is a Language.
Remember coding is learning a new language. You must be able to treat it as such.
Code is Functional.
A computer does not think like a human, at least not yet. It is very logical and linear and you must write for it as such.
You made the mistake, not the computer.
Like I stated before, the computer is only doing what you tell it to do. If something goes wrong, you must have not connected a file, forgot a braket, or mispelt something.
Inspect Element Is Your Friend.
When implementing a website, use "Inspect Element" on a selected text to see the source of the problem or where you will need to make an adjustment.
Use CSS & HTML Properly.
Each language has it's use and has been designed to do so. HTML is the STRUCTURE (blueprints) of the website. CSS is the STYLE (Rendering) of the webpage; where you get to select the size,color,font,etc...