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.

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 ?

1 ответ

  1. The correct way following your syntax is style: "height:100%"

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

    height: "100%" does nothing. 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

    <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
    Make div 100% height of browser window
    height:100%; not working
    CSS height 100% percent not working

    Hope it helps