This works much like getElementById but it lets you get all HTML elements which have been given the class name. As there will be more than one the result is an array. To do anything with those elements you need to say which one you want to change. The easiest way to do that is to use a for loop.
Try it and you should see what it does:
- the CSS styles certain things red using a class
- the for loop runs through that list changing each one in turn
The list of elements which share the class name is actually an object similar to an array. Therefore you can change the properties of that object and it's child objects as you do here.