如何在子文件夹的网页中获取背景图像 [英] how to get background image within webpage of subfolder

查看:126
本文介绍了如何在子文件夹的网页中获取背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好gals

我正在创建具有管理模块的网站.现在我要在管理模块中设置页面的背景图像.

代码如下所示:

<body style="background-image:url(dbg.jpg);"  runat="server">


但我没有得到任何图像.请指导我.


问候,
mehrin

解决方案

您可能面临的问题是图像的相对路径.

根据文档相对于图像的位置,可能无法正常工作.

在CSS中,您无法使用代字号(〜)来获取项目的根目录,我尝试过并且它不起作用,因此您必须使用/.
使用基于根目录的路径.
我还看到人们使用../../表示法跳上树,但这是冒险的,最好扎根.

例如

 <   body    样式  ="      ="  服务器" >  



如果您错过前导的"/",那么您将得到一个相对路径.

<body style="background-image:url(Admin/dbg.jpg)"  runat="server">


hey guys n gals

I am creating website which have admin module..now i want to set background image of the pages,which are in admin module.

the code is as written below:

<body style="background-image:url(dbg.jpg);"  runat="server">


but I am not getting any image. please guide me.


regards,
mehrin

解决方案

The problem you may be facing is relative paths to the image.

Depending on where your document is located relative to the image things may not work as expected.

In CSS you cannot use the tilde (~) symbol to get the project root, i tried and it does not work, so you have to use root based paths using /.

I have also seen people hop up the tree using ../../ notation, but thing this is to risky and better to work root down.

e.g.

<body style="background-image:url(/folder/folder/images/image.jpg)"  runat="server">



if you miss the leading ''/'' you end up with a relative path.


If you are having image under Admin folder then

<body style="background-image:url(Admin/dbg.jpg)"  runat="server">


这篇关于如何在子文件夹的网页中获取背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆