Home >Web Front-end >HTML Tutorial >background-image怎么不能显示_html/css_WEB-ITnose

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

WBOY
WBOYOriginal
2016-06-21 09:03:151572browse

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

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

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


回复讨论(解决方案)

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

@import url(css/my.css);

Statement:
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