加载中…
个人资料
红枫叶
红枫叶
  • 博客等级:
  • 博客积分:0
  • 博客访问:3,061
  • 关注人气:84
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

background-image(CSS) url 路径问题

(2012-09-22 16:02:56)
标签:

杂谈


Background Image


Syntax: background-image:
Possible Values: | none
Initial Value: none
Applies to: All elements
Inherited: No

The background-image property sets the background image of an element. For example:

BODY { background-image: url(/images/foo.gif) }
P    { background-image: url(http://www.htmlhelp.com/bg.png) }

When a background image is defined, a similar background color should also be defined for those not loading images.

Authors may also use the shorthand background property, which is currently better supported than the background-image property.

 

======================================================================

自己在使用 background-image 过程中如:.bg_list00 {
 background-image: url(images/list_bg00.jpg);height:24px;padding-left: 25px;padding-top: 5px;
 font-weight: bold; color: #ffffff;
}

总是找不到 background-image: url 中的图片,后来摸索出算是一个方法吧: 

在jsp页面中使用

链接到这个 css 时就从根目录找起

background-image: url 就直接从该css文件所在路径做为相对路径找起。

 

http://s1/bmiddle/4b62e4a92d14ef6019d20<wbr>url <wbr>路径问题" TITLE="background-image(CSS) <wbr>url <wbr>路径问题" BORDER="0" />

 

如上图目录结构所示,则Css.css文件里 样式 bg_list00 的 background-image应如下定义:

background-image: url(../images/list_bg00.jpg); font-weight: bold; color: #ffffff;
}

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有