background-image怎么不能显示_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:03:15
Original
1533 people have browsed it

只是测试background-image,怎么就是不能显示,大家帮忙看看!~
图片放在和页面同一级文件夹下的imgs子文件夹下,CSS放在和页面同一级文件夹下的css子文件夹下
页面源码如下:

<html><head><style type="text/css">@import "css/my.css";</style></head><body></body></html>
Copy after login

CSS如下:
body{    background-image: url(imgs/11.jpg);}
Copy after login


回复讨论(解决方案)

图片路径要定成相对于css文件的路径,而不是相对于html文件的
background-image: url(../imgs/11.jpg);

@import url(css/my.css);

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!