the size of a nebula is what compresses the gases in space.
a nebula is slowly rotating and the gases, and other space dust, and minerals are slowly moving closer to the center of the nebula.(because of gravity) A star forms when a colossal amount of hydrogen, helium, carbon, oxygen and other trace minerals are all attempting to occupy a very small area in space. this causes those elements to super-heat which creates stars. stars that go supernova usually cause nebulae to collapse faster by causing a wave of distorted gravity(which causes the elements to be moved in one direction faster than if a nebula formed a star normally).