簡體   English   中英

VS Code - 為什么 vscode 不顯示 html 標簽屬性

[英]VS Code - Why vscode doesn't display html tag attributes

我使用 VS Code 進行 HTML 編輯,但是當我輸入標簽時,它不顯示它的屬性,即使我添加了我想要的屬性,它也無法識別它。 我做了以下,但沒有一個工作:

1-我安裝了相關的擴展(HTML CSS Support、HTML Snippets、HTML Boilerplates 等)。 2-添加標簽后,按 Ctrl+Space。 3-重新啟動我的機器。 4-重新安裝VS代碼。

(I entered the css, html code below and the name of my css file is "style post.css" and it is in the folder where my HTML file is located).

我做了我能做的一切,如果有人能指導我,我會很高興。

 h2.head1{ color:red; }
 <.DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Post</title> <link rel="stylesheet" href="style_post.css"> </head> <body> <h1> Scrambled Eggs </h1> <p> eggs are one of my favorite foods.here is recipe for deliciously rich scrambled eggs:<br> </p> <h2 class."head1">Ingredients</h2> <ul> <li> 2eggs </li><li> 1 tbs butter </li><li> 2 tbs cream </li> </ul> <h2>Method</h2> <ol> <li> Melt butter in a frying pan over a medium heat. </li><li> Gently mix the eggs and cream in the bowl. </li><li> once bottle has melt add cream and eggs. </li><li> Using the spatula fold the eggs from the edge of the pan to the center every 20 secend(as if you are making an omelette) </li><li> When the eggs are still moist remove from the heat(it will continue to cook on the plate until served) </li> </ol> </body> </html>

您要么有錯字,要么必須查看如何在 HTML 中設置屬性:您使用以下語法: attribute="value"而不是:

因此,在您的情況下,您應該使用class="head1"

 h2.head1{ color:red; }
 <.DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Post</title> <link rel="stylesheet" href="style_post.css"> </head> <body> <h1> Scrambled Eggs </h1> <p> eggs are one of my favorite foods.here is recipe for deliciously rich scrambled eggs.<br> </p> <h2 class="head1">Ingredients</h2> <ul> <li> 2eggs </li><li> 1 tbs butter </li><li> 2 tbs cream </li> </ul> <h2>Method</h2> <ol> <li> Melt butter in a frying pan over a medium heat. </li><li> Gently mix the eggs and cream in the bowl. </li><li> once bottle has melt add cream and eggs. </li><li> Using the spatula fold the eggs from the edge of the pan to the center every 20 secend(as if you are making an omelette) </li><li> When the eggs are still moist remove from the heat(it will continue to cook on the plate until served) </li> </ol> </body> </html>

感謝用戶:克隆我能夠找到問題第二部分的答案,即“為什么 vscode 不會自動打開一些帶有屬性名稱的標簽”。

我說也許有人和我有類似的問題,可以幫助他/她:)

根據圖,我們要在頁面右下角 select html ,我的問題是語言是 django7D239FDC87ADD26

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM