A clef is actually to do with the musical range an instrument is able to play. Lower instruments use the bass clef, some like the viola use the alto clef and most like the violin use the treble clef. This is because the five lines on sheet music(stave)are not big enough to encompass the whole range. Hope that makes sense.
The word clef comes from the French word meaning key and would account for musicians saying "this is in the key of D" for example.