Many factors contribute to feeling pain but all are controllable. Neck pain results from strains that occur to the muscles and ligaments supporting our spine when the spine is not maintained in a neutral position for an extended period of time. This is particularly true of spines that are already compromised by previous injury, arthritis, misalignment, scoliosis...etc.
Your head weighs approximately 8-12 lbs. It sits atop a column of 7 stacked vertebrae making up the neck. Between each adjacent vertebra, a cushion-like tissue called a disc acts to absorb the weight of your head onto that portion of our spine. Our neck spinal column normally curves forward creating a "C" or reversed "C" depending on what side of a person you're looking at. This allows the spine to bend to further absorb the weight of your head. The ligaments attach the vertebrae together to help maintain them in place. We have a variety of muscles that attach not only vertebrae to vertebrae but also vertebrae to other bones such as our shoulder blades, collar bones, skull...etc. They act as guide wires to help balance the head on the spinal column.
Neck pain is most commonly caused, initially, by these muscles getting fatigued. When we maintain good posture, our head balances on this spinal column with very little strain to these supporting muscles. However, when we look down at a keyboard for an extended time or we slouch causing our head to extend back to see the screen, those same muscles must work much harder to prevent your head from falling off your shoulders because it has veered from its center of gravity.
The concept is best demonstrated by attaching a bowling ball (your head) to the top of a broomstick (your neck spinal column called the cervical region). If you then align it perfectly with its center of gravity, you could balance it on the tip of your finger. Let it fall away from that center of gravity and you must use considerable muscular effort by grabbing it with both hands to prevent it from falling further from its center of gravity. In the same way, look down at the keyboard and your neck muscles have to work much harder to keep your head from falling further which eventually leads to fatigue and pain.
So, what's a person to do?
Maintain good posture to minimize fatigue. Take mini breaks to reduce sustained positions that may lead to muscle fatigue. I recommend getting up every 15 mins to at least walk around the desk and stretch briefly before continuing to work at your desk. Any interruption of that prolonged position will help. Pay attention to proper ergonomics as well. Also, exercise regularly to "burn off" that building muscle tension.
Dr Rick Jardon