Customizing the Tag Helper element.

Amit Rawat 586 Reputation points

I am following below Microsoft link to change the Tag Helper element font.

I am using ImageTagHelper:
<img src="~/images/image1.jpg" alt="image" asp-append-version="true" />

When I change the color to Green from setting "HTML razor tag helper element" Nothing happened.

But when I select another option "HTML razor tag helper Attribute." color of asp-append-version changes.

So, what does "HTML razor tag helper element" do. (Tools > Options > Environment > Fonts and Colors)

A set of technologies in the .NET Framework for building web applications and XML web services.
3,169 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Callida Takemi 1 Reputation point

    The Information you shared above is great. I have been reading all you shared here. In this you explained everything very well. If i want any further guideline we will contact you here

  2. Amit Rawat 586 Reputation points

    I got the difference. There are two settings Within Options -> Environment -> Font & Colors -> Display Items in Visual Studio.

    Setting 1 "HTML Element Name"
    Setting 2 "HTML Razor Tag Helper Element".

    Now because many tag helper share comman name as of HTML Element name. "HTML element override font and color setting for "HTML Razor Tag Helper Element".
    For example color won't change for "Image Tag Helper" because it target <img> which is also an HTML image element. Similary for AnchorTag Helper which target "<a>".

    But if we try withEnvironment tag helper like below, it will work
    <strong>IWebHostEnvironment.EnvironmentName is Staging or Production</strong>

    Or, for "Partial" Tag Helper like:
    <partial name="Amit">