2011-11-08 2 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%"; 

버튼은 실제로 "ContentPane"의 70 % 너비를 차지하지 않는 버튼 "label"속성을 기반으로 표시됩니다.

+0

어떻게 부모 창 스타일되고

// 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); 
? 방화범 같은 것을 사용하여 버튼 너비를 직접 변경하려고하면 어떻게됩니까? – hugomg

+0

인라인이 아닌 블록으로 설정하는 것이 효과가 있습니까? 'node.style.display = "블록"; –

답변

0

첫째, 당신의 CSS에서이 같은 클래스를 정의 :

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

(당신이 사용하는 어떤 테마 이름으로 .claro 교체).

그런 다음, 자바 스크립트, 단지 수행

이 이