Skin is one of the body's major organs, acting as a protective boundary between the body and the rest of the world. The outside layer is called the epidermis, and the inside layer is the dermis, which contains nerve endings, sweat glands, capillaries, and hair follicles. It is the inner layer of the epidermis that is most affected by ultraviolet light, a major part of sunlight. This inner layer contains a type of cell called a melanocyte, which produces the pigment melanin -- the source of a suntan or sunburn.
Exposure to ultraviolet light causes the melanocytes in your skin to produce melanin, which absorbs ultraviolet light to protect the skin cells from sun damage. This is why we tan. Caucasian people have less pigment in their skin than some other races, and thus are more vulnerable to sunburn. A sunburn occurs when skin cells are damaged by ultraviolet light. The body responds by increasing bloodflow to the capillaries in the dermis layer of the skin to repair the damage, and this extra blood causes the redness of a sunburn. Melanocytes are also responsible for developing skin cancer, caused when the cells mutate after repeated exposure to ultraviolet light.
Surface reflections can increase the effects of ultraviolet exposure. For example, snow reflects 90 percent of ultraviolet light, which why is you can get a sunburn while skiing on a sunny day. Sand reflects as much as 20 percent of ultraviolet rays, perhaps one reason some people tan faster at the beach. Glass, however, absorbs ultraviolet light; this is why we don't get sunburned while driving or working in a glassed-in greenhouse.