开发者

Adding a specific styles to a gwt element

开发者 https://www.devze.com 2023-02-01 07:31 出处:网络
Is it possible to add a specific style to a gwt element?? e.g. if I have a开发者_StackOverflow中文版 button

Is it possible to add a specific style to a gwt element??

e.g. if I have a开发者_StackOverflow中文版 button

  Button X= new Button("X");

now if i want the button to be italic

can i do something like that

X.addStyleName("font-style:italic");


The styleName is only valid for an style defined in your CSS file. Check the answer from hilal for more details about it.

If you only need to specify an specific value, you can do something like

DOM.setStyleAttribute(myButton.getElement(), "fontStyle", "italic");

keep in mind that then you're hard coding these value, and any change in the style will require to recompile your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消