子目录内没有加载CSS [英] CSS not loading inside sub directory

查看:62
本文介绍了子目录内没有加载CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过index.php从子目录加载css,并定义了一个常量 AMIN_CSS =http:// localhost / gbl_admin / admin_css



这个在同一个目录下载入css:

 < ; link href =<?php echo ADMIN_PAGE。/ style.css?> type =text / css =stylesheet> 

但这个是在子目录中:

 < link href =<?php echo ADMIN_PAGE。/ admin_css / style.css?> type =text / css =stylesheet> 


//常量decleration
define(SITEURL,'http://'.@$_SERVER ['SERVER_NAME']。/);
define(ADMIN_PAGE,SITEURL。gbl_admin);
define(ADMIN_SCRIPTS,SITEURL。gbl_admin / admin_scripts);
define(ADMIN_CSS,SITEURL。gbl_admin / admin_css);

这个不加载!如何解决这个问题?

解决方案

您提到的第二个链接被视为

http://localhost/gbl_admin/admin_css/admin_css/style.css a>



您可以看到admin_css重复了两次,因此无法加载CSS文件。因此,正确的网址应如下所示:



http ://localhost/gbl_admin/admin_css/style.css


I am trying to load the css from a sub directory through index.php and have defined a constant AMIN_CSS ="http://localhost/gbl_admin/admin_css".

This being in the same directory loads the css:

<link href="<?php echo ADMIN_PAGE."/style.css"?>" type="text/css" rel="stylesheet">

but this one is in the sub directory:

<link href="<?php echo ADMIN_PAGE."/admin_css/style.css"?>" type="text/css" rel="stylesheet">


 //constant decleration
 define("SITEURL",'http://'.@$_SERVER['SERVER_NAME']."/");  
 define("ADMIN_PAGE",SITEURL."gbl_admin");
 define("ADMIN_SCRIPTS",SITEURL."gbl_admin/admin_scripts");
 define("ADMIN_CSS",SITEURL."gbl_admin/admin_css");

This one doesn't load!! How can i solve this?

解决方案

The second link which you are referring is perceived as

http://localhost/gbl_admin/admin_css/admin_css/style.css

You can see that admin_css is repeated twice hence it is not able to load the CSS File. Hence the correct url should be as follows :

http://localhost/gbl_admin/admin_css/style.css

这篇关于子目录内没有加载CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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