How to restrict the size of a Google chrome extension popup?

╄→尐↘猪︶ㄣ 提交于 2019-12-13 07:41:46

问题


I am creating a Google Chrome extension that does some basic search based on the choices provided.

This is how it looks so far

The problem is that there is a lot of white space on the sides which does not look good, especially because this is a popup and overlays on the current page.

How can I make sure that the popup uses the minimum amount of space required?


回答1:


It should be as simple as styling the body element. Do you want a fixed size, fixed width, or just less margins? For fixed size, you should use overflow:scroll or overflow:hidden along with the appropriate width and height. For fixed width, use width and optionally min-height. For any of these, you should check the margins on all the block-level elements to see if that's where your whitespace is coming from.




回答2:


as nkorth said, this is quite easy, using CSS. Let me write out the code for you:

<html>
  <head>
     <style type="text/css">
         body {
            width: 200px;
            height: 200px;
            overflow: hidden;
         }
     </style>
  </head>
  <body>
     text text text
  </body>
</html>



回答3:


You can follow Debugging Tutorial to inspect this popup.

Maybe set the min-width property to body element could fix it. If not, please append the html code, we can check it later.



来源:https://stackoverflow.com/questions/6160568/how-to-restrict-the-size-of-a-google-chrome-extension-popup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!