【发布时间】:2017-08-23 18:19:37
【问题描述】:
我为三种不同尺寸的设备提供了这三个 CSS 链接。
<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/maxwidth959.css" rel='stylesheet'>
<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/maxwidth768.css" rel='stylesheet'>
<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/maxwidth600.css" rel='stylesheet'>
所有媒体查询:
maxwidth959.css
@media only screen and (max-width: 959px)
{
// styles here
}
maxwidth768.css
@media only screen and (max-width: 768px)
{
// styles here
}
最大宽度600.css
@media only screen and (max-width: 600px)
{
// styles here
}
但只有最后一个链接的 css(maxwidth600.css) CSS 生效,其他人覆盖?
【问题讨论】:
-
您的代码没有问题。您是否收到任何错误,例如未加载样式表?
-
@micky 请添加一个 url 或代码并告诉我们什么不起作用,如果无法测试您的代码并重新生成问题,就不可能提供一个好的答案..
-
请告诉我这是否解决了您的问题:stackoverflow.com/questions/8790321/…
-
@Casper
echo is not actually a function (it is a language construct), so you are not required to use parentheses with it.php.net/manual/en/function.echo.php -
您是对的,我什至看到您在传递多个参数时甚至都不允许。谢谢你的纠正。我学到了一些新东西:) @fubar