To do web programming from A-Z you have to have 3 overlapping but distinct fields of understanding:
- HTML & CSS (from programming perspective: mostly how html pages are structured, no need for learning fancy design tricks, half of which are anyway bad, and are a field of specialization by themselves)
- understanding of server/client
technologies (as opposed to
understanding how, let's say, normal
desktop applications like MS Office
work)
- a programming language knowledge - for purposes of learning I would suggest Python or PHP - from my own experience these allow to sooner start concentrating on (1) and (2). Java is a bit "heavy" on how to set it up and work, I'd say. Don't know about others. It may happen, regardless of language you pick, that later on you decide to switch to another.
Your particular choice of learning should depend on the way you learn best, actually, so I would say stating that a book or videolecture is going to be best is kind of wrong - there exist plenty of materials either way.
A book, obviously, can go more in-depth; the only recommendation I would suggest is that at some point (for all 3 fields) you need something that explains the theory behind - the "why", not only "how" - which is something starting level books frequently don't do.
By the way, there is a good chance you read one book that shows an example of "doing X this way", and later on pick another, which explains why doing it "that way" was horribly wrong and a security risk (lots of PHP programming books come to mind).
However, certain hands-on and peeking into existing web applications would be neccessary in any case, in the programming language you choose.
It is hard to say in which order you have to take the fields, but I think the order I stated them could work very well:
-- as you learn (1) you can create your own static pages and link them together, embed images, learn about meta-information and stylesheets, what makes a web page tick.
-- for (2) at this point there should only be so much information so that you understand the concepts (because you can have (static) web pages without client/server just dozing on your hard drive, but you can rarely have web development without client/server).
-- and then you try to learn (3) and make your static web pages dynamic (with embedded code), and pick more about (2) on the way -- the how and whys.
After that there are still plenty of things to advance to: client-side programming (with Javascript) for better user experience, using MVC programming and/or templating systems to reduce repetitive code and ease workload. You will have an intermediate understanding, however, of "how-stuff-works"(tm).
For real web programming you will also very probably need some database understanding: that's the 4th field of knowledge, and a seperate one at that. You will possibly pick up some as you learn (2) and (3) and then on you probably should learn more in-depth - mostly to know what stuff to avoid.
Caveat. The real hurdle of (web and other) programming is that you can easily make stuff that works, but is either clunky and hard to maintain, or a security risk -- and for web apps on Internet, security risks multiply by the inherent vulnerabilities of the client/server engines themselves (which you use to build your web apps). So at some point after learning basics, you would be well advised to learn, which of the things you have learned you should unlearn again and do differently.