1

I am trying to add this thing inside the page, but it's not working. Is there any way to specify these styles inline?

   @font-face {
  font-family: 'Cuprum';
  font-style: normal;
  font-weight: 400;
  src: local('Cuprum'), local('Cuprum-Regular'), url(http://themes.googleusercontent.com/static/fonts/cuprum/v4/sp1_LTSOMWWV0K5VTuZzvQ.woff) format('woff');
}
@font-face {
  font-family: 'Cuprum';
  font-style: normal;
  font-weight: 700;
  src: local('Cuprum Bold'), local('Cuprum-Bold'), url(http://themes.googleusercontent.com/static/fonts/cuprum/v4/SfDyn5tWOk7I1we45jpLKz8E0i7KZn-EPnyo3HZu7kw.woff) format('woff');
}
KatieK
  • 13,586
  • 17
  • 76
  • 90
dean
  • 61
  • 1
  • 3
  • 8
  • Do you mean in a style attribute? I don't think so. In a style element, yes. – FelipeAls Oct 01 '12 at 06:21
  • You couldnt use font-face as a inline style. You can call inside style tag. – Parveen Sharief Oct 01 '12 at 06:33
  • am trying to apply this font in email actually guys but u already know the email not allow to add css classes and css files so is there any way to apply that in email ? – dean Oct 01 '12 at 06:35

1 Answers1

2

Put them in a style element placed inside the head element, e.g.

<!doctype html>
<title>Your title</title>
<style>
  /* put your CSS code here */
</style>
<h1>Hello world</h1>

If you cannot set elements into the head part (as you might be, when compositing email in HTML format, depending on the composing program), then you could try putting the style element inside the body. That would be invalid, but it still works in browsers.

Whether email clients will recognize it and use a downloadable font is a different issue – and depends on the client.

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390
  • is this will work in all browser ?? – dean Oct 01 '12 at 06:45
  • @dean, it means on what you mean by “browser.” It works on normal browsers, but HTML rendering engines in email clients are something different; as you’ve noted, they have varying limitations. – Jukka K. Korpela Oct 01 '12 at 06:48
  • @dean, I just tested by using http://www.labnol.org/internet/send-html-email/19672/ to send HTML email (it lets me enter an HTML document as such, in source code) to myself. I tested the syntax where `style` appears in `body`. When reading the message, Thunderbird shows the text in Cuprum, after I have allowed it to load external content. Even when using the (lousy) webmail system of my ISP, the text surprisingly appears in Cuprum. But when reading it in Gmail, the text appears in Times New Roman. (Looking at the code, it seems that Gmail has stripped off the `style` element.) – Jukka K. Korpela Oct 01 '12 at 07:17