Button Dojo按钮宽度(百分比)

Button Dojo按钮宽度(百分比),button,dojo,width,Button,Dojo,Width,我在DojoContentPane中有一个Dojo按钮 我已经配置了Dojo按钮宽度的百分比,但它没有生效 button = new dijit.form.Button({ id: "mybutton", label: "title", style: "width: 70%; top: 10px; left: 20px;" }, ContentPane); node = button.domNode; node.style.position = "absolute";

我在DojoContentPane中有一个Dojo按钮

我已经配置了Dojo按钮宽度的百分比,但它没有生效

button = new dijit.form.Button({
    id: "mybutton",
    label: "title",
    style: "width: 70%; top: 10px; left: 20px;"
}, ContentPane);

node = button.domNode;
node.style.position = "absolute";
node.style.left = "10px";
node.style.top = "20px";
node.style.width = "70%";

按钮显示基于按钮标签属性,实际上不占ContentPane宽度的70%

首先,在CSS中定义如下类:

.claro .dijitButton .dijitButtonNode, .button {
    width : 70%;
}
用您正在使用的主题名称替换.claro

然后,在javascript上,只需执行以下操作:

// Assuming your contentPane div has an id "contentPane"
var contentPane = dijit.byId("contentPane");
var button = new dijit.form.Button({
    id: "mybutton",
    label: "title",
    class : "button"
});
contentPane.set("content", button);

如何设置父窗格的样式?如果您尝试使用firebug或类似的东西更改按钮宽度,会发生什么情况?如果您将其设置为块而不是内联,会有不同吗?node.style.display=块;