What is the reason behind transparency of an object(say,glass)?

We know that electrons, when excited to a higher energy level from their stable level,have the tendency to regain their stability by releasing extra energy in the form of electromagnetic(e.g.,VIBGYOR) waves.Also,because of this tendency we can see colours of coloured objects.Although,glass is more denser than wood(glass will have more no. of electrons than wood),yet they are perfectly transparent.Think and give the phenomenon involved.