奇怪的 HTML 忽略标签
HTML 似乎完全忽略了这一点:
<link rel="stylesheet" type="text/css" href="../public_html/CSS.php?W=1"/>
它位于头部,并链接到 PHP css 样式表。这是样式表。我在 if 语句中省略了一些内容,纯粹是为了看看是否是语句本身不起作用。
<?php header("Content-type: text/css"); ?>
div{
color:green;
}
body{
background-color:blue;
}
<?
if ($_GET["W"] == 1){?>
div{
color:green;
}
.Center{
align:center;
}
.Login{
border:5px solid green;
align:center;
}
<? } ?>
HTML seems to completely and utterly ignore this:
<link rel="stylesheet" type="text/css" href="../public_html/CSS.php?W=1"/>
It's in the head, and links to a PHP css stylesheet. Here's that stylesheet. I left some out of the if statement, purely to see if it was the statement itself not working.
<?php header("Content-type: text/css"); ?>
div{
color:green;
}
body{
background-color:blue;
}
<?
if ($_GET["W"] == 1){?>
div{
color:green;
}
.Center{
align:center;
}
.Login{
border:5px solid green;
align:center;
}
<? } ?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
public_html
文件夹名称是本地磁盘文件系统上 Web 根文件夹的典型名称。该文件夹本身未发布在网络上,仅发布其内容。元素的
href
属性应指向 Web 路径,而不是本地磁盘文件系统路径。假设
public_html
文件夹确实是您的 Web 根文件夹,并且包含元素的 PHP 文件也在那里,那么 CSS 文件应该按如下方式链接:
The
public_html
folder name is a typical name of the web root folder on the local disk file system. This folder is by itself not published in the web, only its contents are. Thehref
attribute of the<link>
element should point to a web path, not to a local disk file system path.Assuming that
public_html
folder is indeed your web root folder and that the PHP file containing the<link>
element is also there, then the CSS file should rather be linked as follows: