我正在使用本机sassc编译器在Ubuntu系统上使用Intellij中的Siter for Zurb Foundation 6,并尝试更改Foundation断点。我阅读的所有文档都表明,这就像在设置文件中更改断点的值一样简单。
[不幸的是,当我这样做时,我的更改没有任何效果。我希望有人可以告诉我我在做什么错。
我已经在网上搜索了,但是没有发现有关更改断点的故障排除方法,因此,我希望这很简单,并且在某个地方犯了一个小错误。
我都尝试过:1)下载foundation.css文件,并直接在HTML中使用它。暂时注释掉样式表包含内容会导致Foundation无法正常工作。2)将foundation.scss包含到我的styles.scss文件中,并取消注释foundation.scss文件中设置文件的调用行。
生成的CSS文件为:
/**
* Foundation for Sites by ZURB
* Version 6.5.3
* foundation.zurb.com
* Licensed under MIT Open Source
*/
body {
background-color: orange; }
.yellow {
background-color: yellow; }
.red {
background-color: red; }
我将_settings文件中的断点更改为:
$breakpoints: (
small: 0,
medium: 640px,
large: 1024px,
xlarge: 1300px,
xxlarge: 1440px,
);
我的HTML文件非常简单:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="foundation.css">
<link rel="stylesheet" href="styles.css">
<script src="https://code.jquery.com/jquery.js"></script>
</head>
<body>
<div class="grid-x">
<div class="cell small-6 medium-6 large-6 red">
this is a div
</div>
<div class="cell small-6 medium-6 large-6 show-for-large-only yellow">
this is a div
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/what-input/5.2.1/what-input.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/js/foundation.js"></script>
<script>
$(document).ready(function()
{
$(document).foundation();
});
</script>
</body>
</html>
我的SCSS文件也很简单
@import "./scss/foundation.scss";
body {
background-color: orange;
}
.yellow {
background-color: yellow;
}
.red {
background-color: red;
}
我相信对CSS的编译是有效的,因为创建了CSS文件,并且HTML文件与div一起显示。我相信Foundation SCSS文件的编译无法正常工作,因为在包含该文件时,除了标题之外,我什么也没得到。
我希望黄色div在1024px和1300px之间消失,但事实并非如此。它消失在1024px和1200px之间,这是“大”断点的默认窗口。
非常感谢我在哪里可以找到我的错误的根本原因。
希望您现在已经解决了。我遇到了同样的问题,设置$breakpoints
对我也不起作用。我通过设置来使其工作,例如:
$small-breakpoint: 49em;
注意,您必须在em
中设置值,在px
中设置值无效。