1

I am creating an asp.net website in which I want to set the font of a label.I am trying to do this through CSS.The font that I need to apply is Shivaji05, which would not be available on most systems.This is the CSS:

body 
{    
}

@font-face {
    font-family: "Shivaji05"; 
    src:url("/Shivaji05.eot");
    src:url("/Shivaji05.woff")format("woff");
    src:url("/Shivaji05.ttf")format("truetype");
    font-weight: normal;
    font-style: normal;
}


.txtQues
{
    font-family: "Shivaji05";    
    font-size:14px;
    background-color:White;
}

The source:

<head>    
<link href="../FontSettings.css" rel="stylesheet" type="text/css" />    
</head>

<asp:Label ID="lblQuestionText" runat="server" Text="Type Your Question Here" 
Font-Bold="True" EnableTheming="False" CssClass="txtQues"></asp:Label>

But this does not work, is there any mistake in this?how should I get this working?Kindly suggest if there are any other alternatives to this approach.

1 Answer 1

1

Have a look at below code. In addition; custom font will render in every browser once define the font MIME type as well in config file or in IIS setting.

@font-face {
  font-family: 'Shivaji05';
  src: url('Shivaji05.eot'); 
  src: url('Shivaji05.eot?#iefix') format('embedded-opentype'), 
       url('Shivaji05.woff') format('woff'), /* Modern Browsers */
       url('Shivaji05.ttf')  format('truetype'),
       url('Shivaji05.svg#svgFontName') format('svg'); 
}

Note: All latest browser have support for font type woff.

Update

see attached image. Define MIME Type for font format .woff the MIME type will be application/x-font-woff enter image description here

Sign up to request clarification or add additional context in comments.

5 Comments

make sure to upload the font on server and then give a font path in CSS file.
not yet,I haven't done it before,can you give me a few links so that I can understand how I can upload a font on the server. @Kheema Pandey
Normally as you upload the .aspx file, CSS or images on server.
Can I test it on my local computer and in that case how should I go about it. @Kheema Pandey
let me make a example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.