I was recently working on a simple HTML project and created the basic HTML files in Visual Studio 2015. Nothing crazy. But when I ran the project in Chrome, there was some extra space at the top of the page that wasn’t coming from CSS. After inspecting the HTML in Developer Tools, I noticed a strange ﻿ character appearing in the HTML.
I read that these characters are BOMs, or byte order marks (also could be known as zero width no-break space). Some people were able to get rid of these characters by rewriting their HTML file by hand, but even after doing this, the characters were still there.
I finally found this StackOverflow post that describes how Visual Studio evidently saves UTF-8 files “with signature” by default, which also saves BOM characters.
You can save files “without signature” by using the Advanced Save Options in the File menu of Visual Studio.
This will remove any BOM characters from your files.
I also added the Advanced Save Options command to my quick access toolbar:
- Right-click on the toolbar in Visual Studio, then click Customize.
- Click the Commands tab.
- In Toolbars menu, find Standard.
- Click Add Command and add Advanced Save Options.
- Move it where you want (I moved it under Save).