I just want to apply style like "margin-top :10px" on LabelFor In MVC like below syntax.
@Html.LabelFor(m => m.UserName)
Any can suggest that how can I do this.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ramesh PalanivelRank #372 · 6.8K reputationPosted Nov 9, 2017, 12:39 AM EST
Manas MohapatraRank #182 · 13.2K reputationPosted Nov 9, 2017, 1:26 AM EST
Suresh KumarRank #547 · 4.4K reputationPosted Nov 10, 2017, 6:58 AM EST
Satyaprakash SamantarayRank #101 · 21.1K reputationPosted Nov 10, 2017, 10:14 AM EST
SandyRank #2,015 · 718 reputationPosted Nov 10, 2017, 7:45 PM EST
Ramesh PalanivelRank #372 · 6.8K reputationPosted Nov 10, 2017, 7:52 PM EST
Satyaprakash SamantarayRank #101 · 21.1K reputationPosted Nov 10, 2017, 7:52 PM EST
Using @ you can write C# within HTML and with @ also you may write HTML within C#.
Abhishek YadavRank #217 · 11.3K reputationPosted Oct 21, 2022, 9:54 PM EDT
@Html.LabelFor(m => m.UserName,new{@style="margin-top:10px;"})