-1

font is not working

here is CSS code

@font-face {
  font-family: 'Soolidium', sans-serif;
  font-style: normal;
  src:url(http://localhost/changingCinema/font/Soolidium.ttf) format('truetype');
}

heading
        {
            float:left;
            width:100%;
            margin-bottom:10px;
            font-size:54px;
            font-family: 'Soolidium', sans-serif;}

this is HTML

<heading>My heading</heading>

only working when I install this font in my window otherwise not.

Help me plz fast thank you.

  • have you tried using relative URL? – slash197 Oct 01 '15 at 10:40
  • check dev tools is the font has loaded successfully. – orlland Oct 01 '15 at 10:42
  • how can i check in css – Rajnish Rajput Oct 01 '15 at 10:43
  • i cant check in src:url its not showing anything rather than url – Rajnish Rajput Oct 01 '15 at 10:44
  • You need to generate all the other fonts: .eot, .woff, etc. have a look at the font squirrel generator. Also this question has been asked millions of times – Pete Oct 01 '15 at 10:44
  • Possible duplicate of [@font-face not working for my ttf font in all browsers](http://stackoverflow.com/questions/17234768/font-face-not-working-for-my-ttf-font-in-all-browsers) – Pete Oct 01 '15 at 10:46
  • ttf is supported on modern browsers. http://caniuse.com/#feat=ttf – orlland Oct 01 '15 at 10:49
  • Can you try to get http://localhost/changingCinema/font/Soolidium.ttf directly from the browser? – orlland Oct 01 '15 at 10:49
  • What do you mean not working? You can't accessed the font directly? – orlland Oct 01 '15 at 10:56
  • @Orland, ttf only doesn't seem to work in ie11 but I haven't checked in edge, although it does work in ff and chrome, perhaps just include the eot version for crappy ie then? – Pete Oct 01 '15 at 10:58
  • @Orland i can access its shows to save file and its mean that the URL is write dont ask me stupid questions if you have solution so tell me. ok im not new in web development. – Rajnish Rajput Oct 01 '15 at 10:59
  • @RajnishRajput We don't have a clear picture of your setup, so how come that those are stupid questions? You're so rude. Why don't you upload everything so that we can reproduce it on our machines and that way we'll be able to help. – orlland Oct 01 '15 at 11:01
  • how can i upload my fonts here – Rajnish Rajput Oct 01 '15 at 11:04

3 Answers3

0

In Font face set font family name

@font-face {
  font-family: 'Soolidium';
  font-style: normal;
  src: url('http://localhost/changingCinema/font/Soolidium.ttf') format('truetype'); 
  }

For all browser support you have to give url from different font file. (.eot/.woff/.ttf/.svg)

Lemon Kazi
  • 3,308
  • 2
  • 37
  • 67
0

First of all make sure you put your @font-face before any other styles.

If possible you might also need to add additional rules for browser support like this:

@font-face {
    font-family: 'Soolidium', sans-serif;
    src: url('Soolidium.woff2') format('woff2'),
    url('Soolidium.woff') format('woff'),
    url('Soolidium.ttf') format('truetype');
}

And as always check for spelling errors or pointing to the wrong path. Remember you are calling this from your CSS file so you need to point relatively to the font folder.

Chris
  • 432
  • 3
  • 11
-2

Try replacing:

src:url(http://localhost/changingCinema/font/Soolidium.ttf) format('truetype');

with:

src: url('../font/Soolidium.ttf');

Assuming you have a folder named 'font' in your root directory with the font 'Soolidium.ttf' in.

Danny Barber
  • 190
  • 2
  • 15