Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to render # Symbol from Razor, MVC

Tags:

html

c#

razor

I am trying to display the # symbol from a razor file but I get it rendered as the letter N.

I have tried with:

&num ,
&#x23 ,
@Html.Raw("#"), 
<text>#</text> and so on.

but it always turns into the letter N. Any suggestion?

Code Example using tag suggested: It is just html markup within a .cshtml file, I have got the same rendered result for all browsers.

 <section>                                       

  .....
  <p>...and Microsoft SQL Server using C <text>#</text> and.</p>
  ..........

</section>

Html rendered image

like image 493
D.B Avatar asked Jan 02 '26 06:01

D.B


2 Answers

You can try this

<text>#</text>
like image 56
Amirhossein Yari Avatar answered Jan 03 '26 20:01

Amirhossein Yari


If you for example use the font Rationale from Google Fonts (I think it looks close to your font), the # is this symbol:

enter image description here

You could simply use another font for the part where you want to display C#:

<span style="font-family:'Arial'";>C#</span>
like image 35
Claudio P Avatar answered Jan 03 '26 20:01

Claudio P



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!