开发者

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

开发者 https://www.devze.com 2023-01-30 09:31 出处:网络
Is loc开发者_开发问答al file the only allowed as url attribute value in CSS background-image property?It can be from anywhere, just make sure your path is correct.

Is loc开发者_开发问答al file the only allowed as url attribute value in CSS background-image property?


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.


You can use any URL supported


No, did you try it with a full URL?


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)}
0

精彩评论

暂无评论...
验证码 换一张
取 消