简体   繁体   English

默认情况下如何将浏览器上的网页大小减小到90%?

[英]how to reduce the size of the web page on browser to 90% by default?

I want that when my project of gwt loads on any browser its size on browser by default reduces to 90%. 我希望当我的gwt项目在任何浏览器上加载时,默认情况下浏览器上的大小减小到90%。 I searched for it in javascript but couldnt find anything. 我在javascript中搜索了它,但找不到任何东西。

You can try this: 您可以尝试以下方法:

public void onModuleLoad() {
  int totalWidth = Window.getClientWidth();
  GQuery.$(RootPanel.get()).width((int) (totalWidth * 0.9));
}

For downloading GQuery, go to: 要下载GQuery,请转到:

https://code.google.com/p/gwtquery/wiki/Downloads https://code.google.com/p/gwtquery/wiki/Downloads

and download the latest version (right now is gwtquery-1.4.2). 并下载最新版本(现在是gwtquery-1.4.2)。 Then, in your Xxx.gwt.xml introduce: 然后,在您的Xxx.gwt.xml中引入:

<inherits name='com.google.gwt.query.Query'/>

And... happy coding! 还有...快乐的编码!

直接在gwt项目的html页面的主体上添加css,它将完全适合您项目的所有页面。

Try with simple CSS 尝试使用简单的CSS

<style type="text/css">
     .zoom {
          zoom: 0.9; /* all browsers */
         -moz-transform: scale(0.9); /* Firefox */
      }
</style>

hosted JSP/HTML 托管的JSP / HTML

<body class="zoom">

For more info have a look at What Does 'zoom' do in CSS? 有关更多信息,请查看CSS中的“缩放”功能是什么?

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

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