<header class="header">
  <div class="header__title">
  <div class="header__reference">
    <ul class="reference-list">
      <li><a class="reference-list__link" href="https://developer.mozilla.org/en-US/docs/Web/CSS/url">MDN reference</a></li>
      <li><a class="reference-list__link" href="https://caniuse.com/#feat=mdn-css_properties_content_url">caniuse Support</a></li>

  <div class="example">
      In this example, the following <code>div</code> element is using the <code>url()</code> CSS function to give it a background image of a patient water buffalo being groomed by some small birds:
    <div class="example__url">

      <small>Photo by <a href="https://unsplash.com/photos/UpM1Agq8S-w">Githinji Wanjohi</a> on <a href="https://unsplash.com/">Unsplash</a>.</small>
// Demo
.example__url {
  background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/11907/githinji-wanjohi-1094710-unsplash.jpg');

// Pen Setup
.example__url {
  background-size: cover;
  border: 2px solid var(--color-topaz);
  margin-top: var(--size-epsilon);
  padding-top: calc(9 / 12 * 100%); // Preserves the image's aspect ratio
View Compiled
Run Pen

External CSS

  1. https://codepen.io/ericwbailey/pen/vMXWgz.scss

External JavaScript

This Pen doesn't use any external JavaScript resources.