【发布时间】:2015-12-24 13:26:44
【问题描述】:
我想创建一个没有响应的网站,但如果调整窗口大小,所有内容都会按比例放大/缩小,并保持相同的比例。小屏文字太小没关系,第一要务是防止resize时元素重叠
我尝试过使用:
<meta id="meta" name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
和
<script type="text/javascript">
$(document).ready(function () {
$(window).resize(function () {
calculateNewScale();
});
calculateNewScale(); // if the user go to the page and his window is less than 1920px
function calculateNewScale() {
var percentageOn1 = $(window).width() / 1920);
$("body").css({
"-moz-transform": "scale(" + percentageOn1 + ")",
"-webkit-transform": "scale(" + percentageOn1 + ")",
"transform": "scale(" + percentageOn1 + ")"
});
}
});
还有 CSS
body {
width:100vw;
height:100vh;
}
网站在这里:
kotechweb.com/new_focus/page/about_us
问题是,现在调整大小时内容重叠。
【问题讨论】:
-
你可以试试视口单位:caniuse.com/#feat=viewport-units
-
请注意,MySQL 标志不在公共领域。将其用作头像可能会侵犯某些版权 (mysql.com/about/legal/trademark.html)。但是 IANAL。
标签: html css twitter-bootstrap layout