2011-11-08 9 views
0

私はDojo ContentPaneの中にDojoボタンを持っています。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%"; 

ボタンは、実際には70%幅のContentPaneを占めていないボタンの「ラベル」プロパティに基づいて表示します。

.claro .dijitButton .dijitButtonNode, .button { 
    width : 70%; 
} 

(使用しているどんなテーマ名と.claro交換):

+0

を親ウィンドウがスタイリングされている方法は?火かき棒などを使ってボタンの幅を自分で変更しようとするとどうなりますか? – hugomg

+0

インラインではなくブロックとして設定するのは違いますか? 'node.style.display ="ブロック ";' –

答えて

0

まず、あなたのCSSには、このようなクラスを定義します。

はその後、あなたの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); 
関連する問題