Jump to content

Any CSS experts?


Phil

Recommended Posts

I'm trying to install embedded fonts in my web sites so that they render well on Linux, which always seems to sub a bigger font and mess up the layout. I've been tweaking the CSS like crazy, nothing is working. Here's my latest, generated by font squirrel:

 

<style type="text/css">
@font-face {
font-family: 'GeorgiaRegular',"Times New Roman",serif;
src: local('Georgia Regular'), local('Georgia'), url('georgia.ttf')  format('truetype'); /* other browsers */
}
</style>

 

Any idea what I could be doing wrong? The code is at the top of the CSS.

 

Thanks.

Share this post


Link to post
Share on other sites

What browser are you using? I've found that Safari renders sites differently than other browsers.

 

As for @font-face, I've never used it personally because I don't really trust it...there is still no standard support across browsers. For example, I see you're using a True Font. I don't think IE supports TTFs with the @font-face property. Stupid, yes.

 

The only thing I notice differently in your code is that you're using single quotes, when it should be double quotes. Usually in CSS it doesn't matter, but it's quite possible this is one of those picky properties.

Share this post


Link to post
Share on other sites

In Linux, I tried FF and Opera. Safari isn't so bad, in fact I think it's using the embedded font but I can't be sure because it's Safari for Windows.

 

IE doesn't support truetype it's true, but I think that the CSS I'm using won't effect IE since the fonts I want Linux to use are Windows web safe fonts. I've tried the double quotes, no luck. :huh:

Share this post


Link to post
Share on other sites

The only other comment I have would be to use the fill URL for the fonts.

I believe it's the current version of FF and Opera. Opera supposedly supports @font-face in the current version.

 

I have tried the full URL path to the font file, but not with the latest code version, I'll try again. I even tried putting it in a fonts folder at the root level, no luck there. I also read that it might be important to supply both the direct and relative paths, but I'm not sure how the code would look for that.

Share this post


Link to post
Share on other sites

I believe it's the current version of FF and Opera. Opera supposedly supports @font-face in the current version.

 

I have tried the full URL path to the font file, but not with the latest code version, I'll try again. I even tried putting it in a fonts folder at the root level, no luck there. I also read that it might be important to supply both the direct and relative paths, but I'm not sure how the code would look for that.

Well the code is comma delimited and goes in order, from left to right, until it finds it. So in theory, you can just list both of them, one after the other. I'd put local first since that would obviously be more efficient.

 

And this is why I don't use @font-face :lol:

Share this post


Link to post
Share on other sites

So something like this? Should there be a comma or semicolon after the last url? Should "Georgia" be added to the font-family line to cover all the bases?

 

<style type="text/css">

@font-face {

font-family: "GeorgiaRegular","Times New Roman",serif;

src: local("Georgia Regular"), local("Georgia"), url("http://mysite.com/georgia.ttf"), url("http://www.mysite.com/georgia.ttf") format("truetype");

}

</style>

Share this post


Link to post
Share on other sites

I would add Georgie to the font-family line property, yes. As for a semicolon, since it's the last property in the style, it's technically not needed, but I like to always end every property with a semicolon. It's just good practice.

Share this post


Link to post
Share on other sites

Thanks! I'll try it.

 

I think I need to install Ubuntu on another box, this rebooting to another OS just to check is a PITA. <_>

try virtualbox vm java for your ubuntu phil, i tried it the other day for folding and it worked very well and was easy to use...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...