douyin6188 2016-02-13 19:34
浏览 59
已采纳

如何在XAMPP中更改我的目录根目录

I'm using XAMPP and my root is C:/xampp/htdocs. Firstly, I will list my files:

I have index.php file on htdocs/public I have theme.css file on htdocs/public/css

I'm trying to link my css file to my html file like this:

<link rel="stylesheet" href="/css/theme.css" type="text/css">

But it doesn't work. When I right click to the browser and select "view source", and when I click to the href="/css/theme.css", it goes to this direction: http://localhost:8080/css/theme.css

But I want to make it go to this direction: http://localhost:8080/public/css/theme.css

How can I make this happen?

  • 写回答

2条回答 默认 最新

  • duanjinchen5296 2016-02-13 19:43
    关注

    You have to indicate your current directory to include the css file, like this:

    <link rel="stylesheet" href="./css/theme.css" type="text/css">
    

    Here, ./ indicates the current directory.

    Or, you can specify the file path relative to the root directory like this:

    <link rel="stylesheet" href="/public/css/theme.css" type="text/css">
    

    Or, you can just remove this /public/ altogether and include your css file like this:

    <link rel="stylesheet" href="css/theme.css" type="text/css">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?