2

I am having trouble finding any documentation about the following CSS syntax, mainly because any page about 'css url format' is talking about the way URL's are structured, and not this particular syntax:

@font-face{
font-family:awesomefont;
src: url(fonts/awesome.woff) format("woff"),
url(fonts/awesome.ttf) format("truetype")
}

What does the format() part do here? I guess it tells the browsers what type of file they should expect. However, I have not seen it anywhere else except in @font-face declarations, but does it get used outside of that as well?

And how does the 'format' relate to the MIME type of the requested file?

2 Answers 2

3

This is covered in the CSS3 Fonts module:

External references consist of a URL, followed by an optional hint describing the format of the font resource referenced by that URL. The format hint contains a comma-separated list of format strings that denote well-known font formats. Conformant user agents must skip downloading a font resource if the format hints indicate only unsupported or unknown font formats. If no format hints are supplied, the user agent should download the font resource.

The specification makes no mention of MIME types, however.

The format() syntax only appears in the @font-face rule.

Sign up to request clarification or add additional context in comments.

Comments

1

Because there are no defined MIME types for TrueType, OpenType, and Web Open File Format (WOFF) fonts, the MIME type of the file specified is not considered.

Learn more about it: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.