faisal faisal - 6 months ago 35
C# Question

How to change font size while using string.format in asp.net MVC

Referring to the question my code is

@(string.Format("{0:dd MMMM yyyy hh:mm tt}", dr[1]))

How can i change the font size in it

Any help would be highly appreciated


I have changed the code
@(string.Format("<div style='font-size:10px'></div> {0:dd MMMM yyyy hh:mm tt}", dr[1]))

And got the output

enter image description here


If you're trying to statically change the font size of the output, wrap it in HTML:

<span style="font-size:2em;">@(string.Format("{0:dd MMMM yyyy hh:mm tt}", dr[1]))</span>