Ryder
Ryder

Reputation: 514

How To Underline @Html.DisplayFor in mvc

In one criteria I have to underline @Html.Display for like below.

enter image description here

I know to do it simple label but using Razor syntax I tried lot but no luck. Please guide me. Below is my code.

<label style="font-size: xx-large; font-weight: 700">@Html.DisplayFor(Model => Model.Lane_Number, new { @border_bottom:"thick solid #ff000"})</label>

Upvotes: 1

Views: 5463

Answers (1)

CSharper
CSharper

Reputation: 5580

You have to use a span element in order for it to work.

<span class="test" style="border-bottom: 4px solid #CC4040;"> 

       @Html.DisplayFor(x => x.Lane_Number) 

</span>

Make sure if you have any elements below the DisplayFor, they are far enough down on the page or else the underline will be hidden

Upvotes: 1

Related Questions