gwt - Font Size in EM does not behave as expected for a VerticalPanel -


i wish fix 1 font-size in 'px' in start (let's onmoduleload) , have rest of widgets , themes in 'em'. me change , feel different screen resolutions dynamically. here's sample code trying out.

    root = rootpanel.get();     root.getelement().getstyle().setfontsize(40, unit.px);     root.setsize("100%", "100%");      label l = new label("hello world");     l.getelement().getstyle().setfontsize(1, unit.em);     root.add(l);      verticalpanel vp = new verticalpanel();     root.add(vp);      l = new label("hello world");     l.getelement().getstyle().setfontsize(1, unit.em);     vp.add(l); 

ideally both labels of same font-size. second 1 far smaller first one. following code, works expected.

    root = rootpanel.get();     root.getelement().getstyle().setfontsize(40, unit.px);     root.setsize("100%", "100%");      label l = new label("hello world");     l.getelement().getstyle().setfontsize(1, unit.em);     root.add(l);      simplepanel vp = new simplepanel();     root.add(vp);      l = new label("hello world");     l.getelement().getstyle().setfontsize(1, unit.em);     vp.add(l); 

if case, seems should staying away vertical/horizontal panels if wish implement generalized em. tried flextable, same problem again.

are using 1 of default gwt styles in gwt.xml? it's possible font size data being overridden in more complex panels.

at rate, i'm using similar approach myself; did was, set style whole html body right @ start of css, setting font size there in px, used em everywhere else , worked nicely part.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -