HTML label color in ASP.NET MVC

I have a very general web page on which I display information. I have this code in my .cshtml:

<div style="text-align: left">
    Test&nbsp;&nbsp;<p style="color: #1e83ca;"> @Html.Label(Model.MemberName) &nbsp;&nbsp;&nbsp;&nbsp;</p>
    Beruf&nbsp;&nbsp;@Html.Label(Model.ProfessionName)&nbsp;&nbsp;&nbsp;&nbsp;
    Datum&nbsp;&nbsp;@Html.Label(Model.TestTakenDate.ToString()) 
</div>

I want to distinguish between text that I am reading from a database from fixed text. I use a helper shortcut and there is no difference. I get all the black text. How to do only what is in @ Html.label in a different color? OR what else can I use to make them look different.

+5
source share
5 answers

As mentioned in my comments, try using <span>. It will work!

+2
source

I just did the following and it worked for me:

@Html.Label("This is a label", new { style = "color:#ff0000"})
+4
source
@Html.Label(Model.ProfessionName, new {@class = "mylabel" })

css

.mylabel
{
   color: green;
}
+2

@Html.Label.

css:

.database { color: #1e83ca; }

cshtml

@Html.Label(Model.MemberName, new { @class = "database"} )
0

HTML, HTMLHelper Label?

- :

<%= Html.Label("This is a label", new { style : "color:#FF0000;" } ) %>
0

All Articles