← Back to functions

CSS Function

format()

Resources

Hints at the font format in @font-face src declarations to help browsers load the right file.

Syntax

format('format-name')

Example

src: url('font.woff2') format('woff2'), url('font.woff') format('woff');

Common use cases

  • Providing multiple font formats for browser compatibility
  • Prioritizing woff2 for performance
  • Fallback font stacks in @font-face

Practical developer insight

Always list woff2 first in your @font-face src — it's the most compressed format and supported by all modern browsers. woff is a good fallback for older ones.

Related