Re: Change font-size on window resize
There are a couple options using CSS:
1. if your layout supports you can try the 'zoom' property, it's not a
standard but it should work in most browsers. (I would not recommend
it anyway)
2. specify all your font-size's using the 'em' unit, then you can
dynamically change the base font-size and all others should follow
according to their 'em' value. You can find lots of resources over
this subject, this one is a good start: http://www.w3.org/WAI/GL/css2em.htm
This is the code to dynamically change style properties:
DOM.setStyleAttribute(element, property, value);
to get the Body element you can use:
RootPanel.getBodyElement();
Cheers,
Henrique Viecili
On Aug 11, 4:55 am, René <renedewa...@gmail.com> wrote:
> I'm building a game application that is intended to fully occupy a
> browser window. This means that when a user resizes the window, the
> application has to resize as well. This would be straightforward if
> the application only consisted of panels with images, but in my case I
> also need text to scale. What I would like to do is dynamically change
> the "font-size" property in the CSS of a lower-level DIV element that
> is wrapping all other elements in my application. By using relative
> font sizes in the CSS for my encapsulated panels, I'm hoping to
> propagate any changes to the font size of the lower-level element to
> higher-level encapsulated panels.
>
> In fact, when I statically change the font-size of "div{}" in my
> external style sheet, all the text in my application is affected, so
> it seems to be possible. However, I would like to do this dynamically.
> Naively, I expected that I could simple change the font-size of the
> root element (RootLayoutPanel.get().getElement() in my case), but that
> does not have any effect on higher-level text fields. I'm a newbie
> when it comes to CSS, so maybe I'm not getting inheritance correctly.
>
> In a nutshell, is it possible to programmatically change the font-size
> style property for one element and thereby affect all child elements?
>
> Thanks very much in advance!
>
> René
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home