Skip to content
TheChatArchiveThe Chat Archive
Mistralmistral-medium· Mistral AIHugging Face Arena Human Preference 55K

I have a font named MyFont.ttf, why the css src: local(MyFont) doesn't work?

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with gpt-3.5-turbo-0613’s answer.
  1. User

    I have a font named MyFont.ttf, why the css src: local(MyFont) doesn't work?

  2. Mistral Assistant

    The local() CSS function is used to try to load a font from the user's system, using the specified font name. It does not look for the font file in the same directory as the CSS file or the HTML file.

    If you want to use a font file that is located on your own server, you should use the url() function instead of local(). For example:

    @font-face {
      font-family: MyFont;
      src: url('/path/to/MyFont.ttf');
    }
    

    This will tell the browser to load the font file from the specified URL. Make sure that the path to the font file is correct, and that the server is set up to serve .ttf files with the correct MIME type (font/ttf).

    If you want to use the local() function, you will need to make sure that the font is installed on the user's system and that it is using the same name that you specified in the font-family property.

    I hope this helps! Let me know if you have any other questions.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.