开发者

Automatic Text Scale

开发者 https://www.devze.com 2023-02-18 21:04 出处:网络
On my website lukewattchow.zzl.org/ I have made it so that when the browser window scales down the website also scales down. However the text inside the divs need to scale down with the background, an

On my website lukewattchow.zzl.org/ I have made it so that when the browser window scales down the website also scales down. However the text inside the divs need to scale down with the background, and images开发者_运维百科 at the same time. Can anyone help?


i assume you will require some Javascript to adjust font size of the BODY based on some fraction of the browser's width:

(untested pseudo-code; since i never write anything HTML, CSS, or ECMAScript)

var body = document.getElementById("theBody");

var fontSizeInPixels = (16*1680)/document.documentElement.­clientHeight; 
//nominal font size of 12pt (16px) with a 1650px wide browser window

body.style.font-size = fontSizeInPixels+"px";

Edit:

Microsoft had a good article on handling dpi changes:

Making the Web Bigger: DPI Scaling and Internet Explorer 8


Maybe this answer that I just wrote in other question about the same problem can help you

0

精彩评论

暂无评论...
验证码 换一张
取 消