Paul
Paul

Reputation: 1966

CSS: background-image URL - only local files allowed?

Is local file the only allowed as url attribute value in CSS background-image property?

Upvotes: 1

Views: 4149

Answers (4)

Timbadu
Timbadu

Reputation: 1551

I believe you can put any image file as a background-image. You just have to specify the full path: http://soundslikedesign.co.uk/images/photography/QE2%20and%20Chopper.jpg

.item {backround-image: url(http://soundslikedesign.co.uk/images/photography/QE2%20and%20Chopper.jpg)}

Upvotes: 0

Carson
Carson

Reputation: 4651

It can be from anywhere, just make sure your path is correct.

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

For example would be to an image in the 'images' folder. ../ will help you navigate back between folders but I try to stay away from it for larger sites. Absolute URLs should work too, but should also not be relied on in case the image is removed.

Upvotes: 2

Saif al Harthi
Saif al Harthi

Reputation: 2974

You can use any URL supported

Upvotes: 1

Jonathan Wood
Jonathan Wood

Reputation: 67283

No, did you try it with a full URL?

Upvotes: 1

Related Questions