我可以像 IE 或 Firefox 一样使用编程来放大网页吗?

发布于 2024-08-09 20:56:18 字数 296 浏览 2 评论 0原文

简单 - 我有一个 800 x 600 的布局。当我按 Ctrl 和 + 时,它会放大并且看起来很棒。

我想知道是否有 CSS/Javascript 方法可以做到这一点?用户不必这样做(因为用户不会这样做并看到小布局)。

有人发布了同样的问题 使用 Javascript/ 设置 IE“光学变焦”功能CSS 没有得到好的回复。

Simple - I have a layout that is 800 by 600. When I press Ctrl and +, it zooms in and looks wonderful.

I want to know if there's a CSS/Javascript way to do the same? Without the user having to do it (because users will not do it and see the small layout).

Same question was posted by someone Setting IE "Optical Zoom" feature using Javascript/CSS that got no good replies.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

瘫痪情歌 2024-08-16 20:56:18

有一个 zoom CSS 属性,但它是 CSS3 的一部分,很可能不广泛支持。通过使用 JavaScript 在 body 元素上进行设置,您可以缩放整个页面。

我同意您所链接问题的答案的观点,因为应该由用户选择自己的缩放设置。如果您的网站太大/太小而无法看到,则表明您的网站设计存在问题。

There is a zoom CSS property, but it is part of CSS3 and is most likely not widely supported. By setting this on the body element using JavaScript you can zoom the entire page.

I would agree with the sentiments of the answers to the question you linked to though in that it should be up to the user to choose their own zoom settings. If your site is too big/small to see, it indicates a problem with your site design.

人生百味 2024-08-16 20:56:18

您可以将所有尺寸设置为动态(对字体使用 em,对 div/图像尺寸使用 %)。然后使用 javascript 更改主包装器和主字体大小。

您还可以使用 CSS 切换。将所有颜色等放在一个 css 文件中。然后创建 3 或 4 级缩放,并为所有现有类硬编码不同的大小。

示例:

main.css

a{color:red;}

小.css

a{font-size:10px;}

中.css

a{font-size:12px;}

You can set all sizes as dynamic (use em for fonts, % for divs/images sizes). Then change the main wrapper and the main font size using javascript.

You can also use CSS switching. Put all the colors and such in one css file. Then create 3 or 4 levels of zoom and inside hardcode different sizes for all the existing classes.

Example:

main.css

a{color:red;}

small.css

a{font-size:10px;}

medium.css

a{font-size:12px;}
A君 2024-08-16 20:56:18

并非所有的设计(事实上,我敢打赌,如果没有针对性的样式表,没有一个)能够应对当今尺寸截然不同的屏幕,从公共图书馆的纵向屏幕,到具有巨大横向屏幕和小型屏幕的超精细艺术 Mac。小型笔记本电脑 - 后两者经常被高管使用,他们不了解浏览器中的缩放功能如何工作,而且视力通常很差且缺乏耐心。

我的建议是使用 Marcgg 建议的相对大小。如果你真的希望变得超级灵活,你可以使用 javascript 或 browserhawk (或等效的)来测量屏幕尺寸,并为那些确实不适合你的布局的样式表切换。

Not all designs (in fact I'd wager, none, without targeted style sheets) can cope with the vastly different sizes of screen out there today, from portrait orientated screens at public libraries, to ultra fine artworking Macs with giant landscape screens and tiny little laptops - the latter two often used by executives that have NO understanding of how the zoom features in a browser work and also often have terrible eye sight and little patience.

My suggestion is to use relative sizing like Marcgg suggests. If you're really looking to be super flexible the you could use javascript or browserhawk (or equivalent) to measure the screen sizes and switch out style sheets for those that are really not going to work with your layout.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文