Elemental2 - How to set WidthUnionType CSSProperties.width

77 views
Skip to first unread message

richip

unread,
Apr 17, 2018, 5:04:45 PM4/17/18
to GWT Users
I'm trying to set set an HTMLElement.style.width property to an arbitrary value but don't know how the API is used. One mechanism I've seen is to use HTMLElement.setAttribute("style", String), but I'd only like to affect the width property. I'm afraid that if I pass a width string (say, "width: 20px") to setAttribute, it would reset/unset all the other style properties.

Thomas Broyer

unread,
Apr 18, 2018, 2:09:46 AM4/18/18
to GWT Users
That would be element.style.width = WidthUnionType.of("20px")

richip

unread,
Apr 20, 2018, 7:00:39 PM4/20/18
to GWT Users
That did it! Thanks.

Very interesting API. I hope the documentation is in the works (API and Users Guide). I'd love to help.
Reply all
Reply to author
Forward
0 new messages