简体   繁体   English

如何在更改窗口大小时调整网页上的文本?

[英]How to adjust text on the web page page on changing window size?

i am using mobile jquery for designing. 我正在使用移动jquery进行设计。 i want to adjust the text on my webpage/screen so that it will auto adjust on all the mobile devices. 我想调整网页/屏幕上的文字,以便在所有移动设备上自动调整文字。 How can i acive this? 我该如何接受? any idea? 任何想法?

Set the width and height on the body and html elements to max out the page. 在body和html元素上设置宽度和高度,以使页面最大。 I know, it's odd that you have to set the html element too, but that's life. 我知道,您也必须设置html元素也很奇怪,但这就是生活。

html, body {
    width:100%;
    height:100%;
}

In your markup define your sections. 在您的标记中定义您的部分。

<section>...</section>
<section>...</section>
<section>...</section>

And resize your sections to fit on load and when the page is resized. 并调整页面的大小以适合加载和页面调整大小。 Something like: 就像是:

function draw() {
    var width = $(document).width();
    var height = $(document).height();

    $("section").width(width).height(height);
}

$(document).resize(draw);
$(draw);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM