Hats are compulsory at a diminishing number of British social occasions.
Women should wear a hat to Royal Ascot and smart race meetings; hats are traditional, but by no means compulsory, at British weddings, and a matter of personal choice for christenings or funerals.
It is notoriously difficult to socially kiss while wearing a wide-brimmed hat. There is a knack to tilting the head at a suitable angle, but two ladies both in wide brimmed hats should avoid such an 'intimate' greeting.
Nowadays in Britain, gentlemen rarely wear hats except for morning dress, when grey felt top hats are de rigueur. They should be worn on the front of the head or carried under the arm, but should not be worn indoors or in the formal photographs.
For the Royal Enclosure at Royal Ascot, however, they are obligatory and must be worn at all times. It's also important to perfect 'doffing' a top hat - raising it above the head to greet guests with real panache.
Baseball caps are, first and foremost, a 'youth' fashion. They should only be worn with extremely casual clothes, or for sport. They should never be worn back to front.