Vscode預設是在控制檯下檢視html檔案,對於我們檢視和除錯都很不方便,那如何在瀏覽器中開啟呢?
1.新建一個HTML檔案

2.點選左側的擴充套件,開啟擴充套件欄

3.在擴充套件欄的搜尋欄中輸入open in browser,找到open in browser這款外掛,點選右下角“安裝”字樣即可安裝。
因為我已經安裝了,所以再搜尋不會顯示安裝字樣

4.安裝完成後可以看一下這款外掛的擴充套件文件,裡面有外掛的各種資訊,及外掛的使用方式等
我們可以看到在預設瀏覽器中開啟是:Alt + B
,在其他瀏覽器中顯示是:Shift+Alt+B

5.回到我們剛開始建的HTML檔案,在檔案中滑鼠右鍵單擊,在彈出的視窗中選擇使用預設瀏覽器開啟或者其他瀏覽器開啟,也可以使用我們上面說的快捷鍵(Alt + B
或Shift+Alt+B
)開啟。

6.假如你想用其他瀏覽器開啟,就選擇Open In Other Browsers(Shift+Alt+B,頂部會出現一個命令框,其中會顯示可以使用的瀏覽器,選擇自己需要的瀏覽器即可,在此,我們使用chrome開啟。

