"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to Fix "property value expected css" and "at-rule or selector expected css" Errors in Go Templates?

How to Fix "property value expected css" and "at-rule or selector expected css" Errors in Go Templates?

Published on 2024-11-21
Browse:734

How to Fix

Troubleshooting "property value expected css" and "at-rule or selector expected css" Errors in Go Templates

Developers working with Go templates and the html/template package may encounter the following errors in Visual Studio Code (VSCode):

  • "property value expected css"
  • "at-rule or selector expected css"

These errors often arise when attempting to inject dynamic values into style attributes using double curly braces {{ }} in .tmpl files.

The issue stems from the HTML validation feature in VSCode. While it helps ensure the validity of HTML syntax, it can also conflict with the use of Go templates. To resolve the problem:

  1. Open Settings in VSCode (Ctrl/Cmd ,).
  2. Search for "validate styles".
  3. Uncheck the "HTML: Validate styles" checkbox.

vscode disable validate style html

  1. Reload VSCode.

After disabling style validation, double curly braces {{ }} can be used in style attributes without triggering errors.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3