I have panels in my web app, and I am setting style attributes like so:
panel.setStyleAttribute('margin-left', 'auto').setStyleAttribute('margin-right','auto');
This wors perfectly in chrome, centering the element as expected. However in IE, the elements are stuck to the left of the screen.
Is there any way around this issue ?
Unlike other browsers, margin:auto only works in Internet Explorer if you force standards mode rather than quirks mode.
UiApp defaults to quirks mode CSS rules, unless (a) you load a GuiBuilder component in the initial app creation, which forces standards mode, or (b) you explicitly ask for standards mode.
This will set you in standards mode and therefore work in IE too:
Note the setStandardsMode(true) – without this it won’t work in IE. Be careful though because standards mode styles are interpreted differently sometimes than quirks mode, so this might change other aspects of your layout.
Some notes: