简体   繁体   English

以%设置Dojo的Button高度?

[英]Set Dojo's Button height in %?

I'm trying to create a dojo Button and set it inside a spanned on 2 rows table cell toking the whole presented height inside it, anyway due some reason it does not works. 我正在尝试创建一个dojo Button并将其设置在2行表格单元格内,从而使其内部呈现的整个高度变高,无论如何由于某种原因它无法正常工作。

require( [  "dijit/form/Button" , "dojo/dom", "dojo/parser"],
  function(  Button, dom, parser )
  {
     var buttonExecuteQuery = new Button(
     {
           id        : "btnExecuteQuery",
           busyLabel : "Изпълнява",
           label     : "Изпълни",                    
           style     : "height:100%",
           height    : "100%"
     });
})
  • How to setup Dojo's Button height ? 如何设置Dojo的Button高度?

The correct way following your syntax is style: "height:100%" 遵循语法的正确方法是style: "height:100%"

var buttonExecuteQuery = new Button(
    {
        id        : "btnExecuteQuery",
        busyLabel : "Изпълнява",
        label     : "Изпълни",                    
        style     : "height:100%"
    }
);

height: "100%" does nothing. height: "100%"不执行任何操作。 Now, the most important part, you need to understand that height: "100%" only works if the height of the parent is known, for example, if you want the button to occupy the full height of a div, then you must set the height of that div 现在,最重要的部分是,您需要了解一下height: "100%"仅在已知父级的高度时才有效,例如,如果您希望按钮占据div的整个高度,则必须设置该div的高度

<div style="height: 50px">
    <button style="height: 100%">My Button</button>
</div>

the are a lot of discussion of this topic here in SO, for example you can read SO中对此主题的讨论很多,例如,您可以阅读
Make div 100% height of browser window 使div的浏览器窗口高度为100%
height:100%; 高度:100%; not working 不工作
CSS height 100% percent not working CSS高度100%不起作用

Hope it helps 希望能帮助到你

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

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