Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

When should CSS font-family value use quotes?

When should CSS font-family value use quotes?

Problem

When should the value for CSS 'font-family' have quotes around it?

I've seen both font-family: arial and font-family: "arial".

As a specific example, I declare a font this way:

@font-face {
    font-family: 'entypo';
    font-style: normal;
    font-weight: 400;
    src: url('/css/fonts/entypo.woff') format('woff');
}

What would be the correct CSS to have an element use this font-family?

Problem courtesy of: Don P

Solution

You only need quotes when the font itself has a space such as "Times New Roman".

Arial does not need quotes, but some people use quotes such as "Arial" to be more consistent. It is simply personal preference.

Seen in Justin's below comment: font-family: times new roman; works without spaces (jsFiddle).

You can call your new @font-face using font-family: 'entypo'; as you would normally expect. (link)

Solution courtesy of: SuckerForMayhem

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

When should CSS font-family value use quotes?

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×