How to go up a level in the src path of a URL in CSS?

Spread the love

Sometimes, we want to go up a level in the src path of a URL in CSS.

In this article, we’ll look at how to go up a level in the src path of a URL in CSS.

How to go up a level in the src path of a URL in CSS?

To go up a level in the src path of a URL in CSS, we use ../.

For instance, we write

div {
  background-image: url("../images/bg.png");
}

to set the background image of the div to one level up from the /images folder.

And we reference the bg.png image from that folder.

Conclusion

To go up a level in the src path of a URL in CSS, we use ../.

Leave a Reply

Your email address will not be published. Required fields are marked *