I was coding html with Visual studio, and became so frustrated that CSS sometimes didn’t work and there were some mysterious white gaps.
After struggling for hours I noticed that there were some “
﻿” in the code.
These characters are byte order marks (BOMs), aka “zero width no-break space”, which are totally invisible in the editor (but if you open it in Word and show the hidden marks, they’ll show). In Word they can be replaced with ^u8520.
Visual Studio saves UTF-8 files “with signature” by default, which also saves the BOM characters.
The remedy is to choose the encoding “UTF-8 without signature”.