I have an element in GWT.I want it to float right .I have used - DOM.setStyleAttribute(element, "float", "right");-which is not working .I am not sure if I am using correct arrtibute('float').Please advise.Thanks in advance
Ok this begs the obvious question... why aren't you using GWT layout to do this? That's kinda the point of GWT is to (at least in part) abstract CSS positioning/layout. Or, rather, to use the more familiar desktop GUI layout models (BoxLayout, GridLayout and so forth).
My thought here would be that you solve this in a static XHTML and CSS file approach. Then once you have it working there, you can transpose that into a gwt approach.
With the GWT approach I would still promote the philosophy of styling and presentation remain in the CSS file, static structure remains in the host HTML file, and dynamic widget placement occurs in the GWT code.
Worth reminding (or mentioning) that as you layout these DIVs and SPANs to use ids, to help you locate that element within your GWT code and populate it with your dynamic controls. Of course, the use of "class" in the element definitions to improve the CSS you will use to perform the float.
The correct way to float is with "cssFloat" property:
DOM.setStyleAttribute(element, "cssFloat", "right");
"float" is a reserved keyword in javascript.