我正在使用 unsemantic 网格布局,但是,使用以下代码,当分辨率位于数位板范围内时,我希望 body div调整为100%:
<div class="grid-parent tablet-grid-100 grid-80" id="body">
<div class="grid-100" id="search-result">
search return
</div>
<div class="grid-50" id="column-left">Column left</div>
<div class="grid-50" id="column-right">Column right</div>
</div>
然而,在达到移动尺寸(默认为100%)之前,它仍保持在80%。我已经包含了以下css文件:
<link rel="stylesheet" href="./assets/stylesheets/demo.css" />
<link rel="stylesheet" href="./assets/stylesheets/dan.css" />
<link rel="stylesheet" href="./assets/stylesheets/unsemantic-grid-base.css" />
<link rel="stylesheet" href="./assets/stylesheets/unsemantic-grid-responsive-tablet.css" />
<noscript>
<link rel="stylesheet" href="./assets/stylesheets/unsemantic-grid-mobile.css" />
</noscript>
<script>
var ADAPT_CONFIG = {
path: './assets/stylesheets/',
dynamic: true,
range: [
'0 to 767px = unsemantic-grid-mobile.css',
'767px = unsemantic-grid-desktop.css'
]
};
</script>
<script src="./assets/javascripts/adapt.min.js"></script>
我真的不明白为什么它不起作用!
答案 0 :(得分:0)
似乎你必须通过自适应调用unsemantic-grid-tablet.css,而不是通过链接调用unsemantic-grid-responsive-tablet.css。试试这段代码:
<link rel="stylesheet" href="./assets/stylesheets/demo.css" />
<link rel="stylesheet" href="./assets/stylesheets/dan.css" />
<link rel="stylesheet" href="./assets/stylesheets/unsemantic-grid-base.css" />
<noscript>
<link rel="stylesheet" href="./assets/stylesheets/unsemantic-grid-mobile.css" />
</noscript>
<script>
var ADAPT_CONFIG = {
path: './assets/stylesheets/',
dynamic: true,
range: [
'0 to 767px = unsemantic-grid-mobile.css',
'767px to 1025px = unsemantic-grid-tablet.css',
'1025px = unsemantic-grid-desktop.css'
]
};
</script>
<script src="./assets/javascripts/adapt.min.js"></script>
答案 1 :(得分:0)
将 Unsemantic 与 Adapt.js 一起用于平板电脑断点的用例:
我能够成功测试以下内容:
<link rel="stylesheet" href="./assets/stylesheets/demo.css">
<link rel="stylesheet" href="./assets/stylesheets/dan.css">
<link rel="stylesheet" href="./assets/stylesheets/unsemantic-grid-base.css">
<noscript>
<link rel="stylesheet" href="./assets/stylesheets/unsemantic-grid-responsive-tablet.css">
</noscript>
<script>
var ADAPT_CONFIG = {
path: './assets/stylesheets/',
dynamic: true,
range: [
'0 to 767px = unsemantic-grid-mobile.css',
'767px to 1025px = unsemantic-grid-tablet.css',
'1025px = unsemantic-grid-desktop.css'
]
};
</script>
<script src="./assets/javascripts/adapt.min.js"></script>
体:
<div class="grid-parent grid-80 prefix-10 tablet-grid-100" id="body">
<div class="grid-100" id="search-result">
search return
</div>
<div class="grid-50" id="column-left">column left</div>
<div class="grid-50" id="column-right">column right</div>
</div>