Earth is a ‘rocky’ planet. Most of its mass comes from elements that are solids. Then come the liquids, then the gases. (for all: at natural temperatures)
Sulfur and carbon exist as solids and gases in nature. Nitrogen, hydrogen, and oxygen are gases. The latter two can combine to form the most abundant liquid: water — which can also be solid or a gaseous vapor. (All gases can get trapped in solids, but that does not make the former constituent elements of the latter.)