← Back to functions

CSS Function

url()

Resources

Inserts an external resource such as an image, font, or SVG.

Syntax

url('path')

Example

background-image: url('/images/hero.jpg');

Common use cases

  • Setting background images
  • Loading custom fonts with @font-face
  • Referencing SVGs in masks or filters

Practical developer insight

Always quote URLs in modern CSS and prefer relative paths for portability. For SVGs, you can also inline data URIs with url('data:image/svg+xml,...').

Related