简体   繁体   中英

embedding fonts in asp.net

I am trying to embed some fonts via a CSS file for my asp.net website but without success.

Here is the code for the CSS:

@font-face {
  font-family: Segoe UI;
  src: url('SEGOEUI.ttf');
}

@font-face {
  font-family: Segoe WP;
  src: url('SEGOEWP.ttf');
}
body  
{
    background: Black;
    font-size: .80em;
    font-family:'Segoe WP';
    margin: 0px;
    padding: 0px;
    color: black;
}

And the CSS file and fonts are all within the Styles folder which is in the root of the site. Running IE10 and Win 7.

What am I missing in getting this to work?

UPDATE: I have converted the fonts to EOT and called them like this:

@font-face {
      font-family: 'Segoe UI';
      src: url('SEGOEUI.eot');
    }

    @font-face {
      font-family: 'Segoe WP';
      src: url('SEGOEWP.eot');
    }

But still nothing.

TTF doesn't seem to be supported by IE. See http://www.w3schools.com/css3/css3_fonts.asp .

Internet Explorer 9+ , Firefox, Chrome, Safari, and Opera support the WOFF (Web Open Font Format) font.

Firefox, Chrome, Safari, and Opera support fonts of type TTF (True Type Fonts) and OTF (OpenType Fonts).

Internet Explorer also supports EOT (Embedded OpenType) fonts.

Which means WOFF or EOT could be a way to go for you. There are many free online font converters, you can try http://www.font2web.com/ or http://ttf2woff.com/ .

In IE you have to specify the real font name, some converter give the font after conversion a generated name by generator witch IE can't handle. Use this website http://www.font-face-generator.com/ and for fonts with spaced in name use double quotes like

font-family: "Segoe UI", Arial;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM