I am using em dashes and writing in British English. I would like to know if I should put spaces both before and after the em dash.
It depends on the style guide you are using – some will require use of spaces, others will not. If you are not following a style guide, then it depends on the particular font you are using, the context (e.g., print or screen, large or small) and your taste and judgement as a designer.
Butterick in Practical Typography:
Em and en dashes are typically set flush against the surrounding text. Some fonts include a little white space around the em dash; some don’t. If your em dashes look like they’re being crushed—particularly if you’re setting type on screen—it’s fine to add word spaces before and after.
Fans of Robert Bringhurst’s book The Elements of Typographic Style (and I am among them—see bibliography) may know that he recommends using en dashes with spaces rather than em dashes. Perhaps this practice is common in Mr. Bringhurst’s native Canada. But in American typography, it’s not.
The practice of using en dashes with spaces is common in British typography. The practice of using em dashes with spaces less so, although News UK papers (The Times, The Sun) use this style.
If you are using spaces, then the question becomes: “how much?”
HTML supports a character called a thin space which is roughly half the width of a word space. A thin space can be useful in situations where a standard word space seems too large, for instance after the periods in W. A. Dwiggins.
If you thought that was the limit of word-space geekery, think again. Professional page-layout programs have even more choices. Adobe InDesign, for instance, supports the thin space, but also the third space, quarter space, sixth space, flush space, hair space, figure space, and punctuation space.
Other questions and answers on this site amply explore the usage of spaces around punctuation marks, including dashes. In particular David's answers are in-depth, scolarly, and well worth reading:
However, a word of caution: I would advocate for typography that serves the reader. Do not blindy follow rules. Favour clarity, readability and the expectations of your audience over other concerns (unless your editor demands conforming to a style guide). Use critical judgement. It may be that following convention is the best route to these ends (it usually is), but it may not. HTML design principle 3.2. Priority of Constituencies is salient here:
In case of conflict, consider users over authors over implementors over specifiers over theoretical purity. In other words costs or difficulties to the user should be given more weight than costs to authors; which in turn should be given more weight than costs to implementors; which should be given more weight than costs to authors of the spec itself, which should be given more weight than those proposing changes for theoretical reasons alone. Of course, it is preferred to make things better for multiple constituencies at once.
I will give Butterick the final word from who is typography for?:
Typography is for the benefit of the reader, not the writer.