I know I didn't answer the same question when asked before about how I came to learn "this stuff". I would say similar to gjh42 that learnt basic (commodore basic) from a little input from my father who was familiar with programming logic from using punch cards at his work, my brother who had "checked out" a computer from the local library, and some user manual that came with the C-64. From there generally self taught, taking classes in school to learn new languages.
As for CSS, I'm still trying to learn it and do rely (unfortunately) on the help afforded by auto utilities, trial and error, and examples at the moment. It's an area I see I need to improve on, but in the mean time I tend to lean on the help of others that are more knowledgeable. I would like to learn more about CSS but haven't invested the time yet.
The rest of the programming things, well all programming language training begins with some of the basics. I don't think I have seen a language book that doesn't start with how to display on the screen Hello, world. Then to go onto the various other functions and ways to manipulate data, if statements, loops (for, wend, while, do, etc...), variables, arrays, classes, functions, recursive functions, modules, etc... Then there are things about each language that gives it it's strength(s) and capabilities. Generally involves knowing where you are (what you have) and knowing what you want and then developing the path to get there. More often than not there is more than one path, but there are tradeoffs and considerations to be made to efficiently resolve the issue without interfering with other attributes and without wasting process/user time and associated resources. This last part is more of a systems thinking perspective. Black boxes along the way that do what they need to all working together.