The only real way to avoid sunburn is to protect the skin, either with light clothing or sun screen (with a sun protection factor right for your type of skin).
The hours from late morning until late afternoon are when the sun is highest, so it's particularly important to protect the sun during those hours. Sun screen should always be reapplied after swimming.
A summer hat can prevent the scalp from burning.
Fair-skinned people are at higher risk. People who haven't had much sun exposure all Winter are as well. Extra care should be taken to keep children protected with light cover-ups, hats, and sunscreen.