样式表不显示在WAMP项目 [英] Stylesheet not being displayed in WAMP project

查看:1081
本文介绍了样式表不显示在WAMP项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在关注本指南使用虚拟建立一个WAMP项目主机。

当我浏览到本地主机/网页,它加载我的主页,但没有样式表或图像。这里是文件结构:


  • WAMP /网络/网站/的index.php

  • WAMP /网络/网站/图像/ image.png

  • WAMP /网络/网站/风格/ style.css中

的httpd-vhosts.conf:

 <虚拟主机*:80>
    的DocumentRootC:/ WAMP / WWW
    服务器名本地主机
    ServerAlias​​本地主机
    <目录C:/ WAMP / WWW>
        所有的AllowOverride
        要求地方
    < /目录>
< /虚拟主机><虚拟主机*:80>
    的DocumentRootC:/ WAMP /网络/网站
    服务器名称的网站
    <目录C:/ WAMP /网络/网站>
        所有的AllowOverride
        要求地方
    < /目录>
< /虚拟主机>

---

另外,顺便说一句,我不能让我的虚拟主机一节出现在wampmanager菜单;我已经加入从引导参数并重新启动wampserver但我仍然没有看到它。这里是我的[Menu.Left]部分wampmanager.tpl:

  [Menu.Left]
; WAMPMENULEFTSTART
类型:分离器;图片说明:由阿尔特路
类型:项目;图片说明:$ {} w_localhost;操作:运行;文件名:$ {} c_navigator;参数:HTTP://本地主机/;雕文:5
; WAMPPROJECTSUBMENU
; WAMPVHOSTSUBMENU


解决方案

如果在你的HTML的路径样式表样式/ style.css文件或/styles/style.css,那么它将被指向WAMP / WWW /款式/ style.css中,而不是WAMP /网络/网站/风格/ style.css中。

既然你要设置一个虚拟主机,我假设你打算使用它。你会想你的浏览器指向网站/,而不是本地主机/网站/。如果您将浏览器指向到localhost /网站/那么你实际使用的第一个虚拟主机条目,而不是第二。

在您的浏览器指向正确的主机,CSS的应该正常工作,因为它会再点WAMP /网络/网站/风格/ style.css中。

I have been following this guide to setting up a WAMP project using Virtual Hosts.

When I browse to "localhost/website", it loads my homepage but without the stylesheet or any images. Here is the file structure:

  • wamp/www/website/index.php
  • wamp/www/website/images/image.png
  • wamp/www/website/styles/style.css

httpd-vhosts.conf:

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory "c:/wamp/www">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/website"
    ServerName website
    <Directory "c:/wamp/www/website">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

---

Also, as an aside, I can't get the "My Virtual Hosts" section to appear in the wampmanager menu; I have added the parameter from the guide and restarted wampserver but I still don't see it. Here is my [Menu.Left] section in wampmanager.tpl:

[Menu.Left]
;WAMPMENULEFTSTART
Type: separator; Caption: "Powered by Alter Way"
Type: item; Caption: "${w_localhost}"; Action: run; FileName: "${c_navigator}"; Parameters: "http://localhost/"; Glyph: 5
;WAMPPROJECTSUBMENU
;WAMPVHOSTSUBMENU

解决方案

If the path to your stylesheet in your HTML is styles/style.css or /styles/style.css, then it will be pointing to wamp/www/styles/style.css rather than wamp/www/website/styles/style.css.

Since you are setting up a virtualhost, I assume you meant to use it. You will want to point your browser to website/, rather than localhost/website/. If you point your browser to localhost/website/ then you are actually using the first virtualhost entry rather than the second.

Once you point your browser to the correct host, the css should work properly since it will then point to wamp/www/website/styles/style.css.

这篇关于样式表不显示在WAMP项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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