Although sunscreen blocks most of the UVB rays that trigger vitamin D production, you can still get enough vitamin D from the sun and protect your skin.