We present a systematic density functional theory study of the electronic properties, optical spectra, and relative thermodynamic stability of semiconducting graphene nanoribbons. We consider ribbons with different edge nature including bare and hydrogen-terminated ribbons, several crystallographic orientations, and widths up to 3 nm. Our results can be extrapolated to wider ribbons providing a qualitative way of determining the electronic properties of ribbons with widths of practical significance. We predict that in order to produce materials with band gaps similar to Ge or InN. the width of the ribbons must be between 2 and 3 nm. If larger bang gap ribbons are needed (like Si, InP, or GaAs), their width must be reduced to 1-2 nm. According to the extrapolated inverse power law obtained in this work, armchair carbon nanoribbons of widths larger than 8 nm will present a maximum band gap of 0.3 eV, while for ribbons with a width of 80 nm the maximum possible band gap is 0.05 eV. For chiral nanoribbons the band gap oscillations rapidly vanish as a function of the chiral angle indicating that a careful design of their crystallographic nature is an essential ingredient for controlling their electronic properties. Optical excitations show important differences between ribbons with and without hydrogen termination and are found to be sensitive to the carbon nanoribbon width. This should provide a practical way of revealing information on their size and the nature of their edges.