blurryMVC
blurryMVC

Reputation: 93

MVC View <text> Styling

This is probably for dummies question, but how to set styling inside <text>? For example to col put colour in:

@{
      if (TempData.Count != 0)
      {
          <text>The quantity available is  @TempData["checkQuantity"]</text>
      }
}

Upvotes: 0

Views: 63

Answers (1)

SLaks
SLaks

Reputation: 888283

<text> is not an HTML tag; rather, it's a special symbol that tells Razor that whatever is inside of it is not code.

If you want to apply CSS, you need to use an HTML tag.
Razor is smart enough to realize that an HTML tag inside a code block is not code, so you don't need to do anything different:

@if (TempData.Count > 0) {
    <strong class="MyClass">...</strong>
}

Upvotes: 3

Related Questions