【发布时间】:2018-03-18 04:17:30
【问题描述】:
我的网站上有以下 jQuery 以确保高度始终全屏:
$(document).ready(function () {
'use strict';
sizeContent();
$(window).resize(sizeContent);
});
function sizeContent() {
'use strict';
var newHeight = $("html").height() + "px";
$(".wrapper").css("min-height", newHeight);
}
这很好用。但是,当我尝试将媒体查询添加到我的 css 以更改文档中字体的大小时,似乎 jQuery 代码“阻止”了 css 计算屏幕宽度。 这可能是一个问题吗? 如果是,如何用最少的 jQuery 解决?
提前谢谢你!
编辑:
这是css:
@media screen {
html, body {
height: 100%;
margin: 0;
overflow: hidden;
}
a {
font-family: letter-gothic-std, monospace;
font-style: normal;
font-weight: 400;
font-size: 1.1em;
text-decoration: none;
color: #6f97a7;
}
}
@media (max-width: 768px) {
a {
font-size: 2em;
}
}
链接的大小根本没有改变。
【问题讨论】:
-
你使用什么媒体查询?
-
你是如何在css中使用媒体查询的,我试过你的代码,不管有没有媒体查询,你能发布相关的css/html吗?
-
我编辑了我的帖子并添加了 css。
标签: jquery css media-queries