A great way of learning this is by looking at others coding. Another good way is to go to tutorial sites, and make sure when you are doing these you dont just copy and paste. Actually do them by hand so you will learn. I recommend
Tutorials - Pixel2life Free Tutorial Search Engine for all of tutorials all around. P2L is a database of tutorials that people submit to. You can find all kinds of good tutorials there if you look around.