Changing label style in uibinder?

542 views
Skip to first unread message

membersound

unread,
Jan 7, 2013, 7:12:36 AM1/7/13
to google-we...@googlegroups.com
The following Label is not bold. What am I missing here?

<ui:style>
    .gwt-label {
        font-style: bold !important;
    }
</ui:style>


<gwt:Label>bold</gwt:Label>

Thomas Broyer

unread,
Jan 7, 2013, 7:30:49 AM1/7/13
to google-we...@googlegroups.com

On Monday, January 7, 2013 1:12:36 PM UTC+1, membersound wrote:
The following Label is not bold. What am I missing here?

Many, many things.

  1. The default style name for a Label is gwt-Label, not gwt-label
  2. to turn text bold, the property to use is font-weight, not font-style
  3. <ui:style> is an implicit CssResource and will obfuscate the class names; you'd need an "@external gwt-Label;" line to turn obfuscation off
  4. but then you'd turn absolutely all Label-s of your application bold; if that's what you want, then you shouldn't do that in a <ui:style> in UiBinder, but rather in a CssResource that you inject right from your EntryPoint, or in a plain old CSS file, to make it clear (for you, when you'll get back to it a few months from now) that it's a global style.
You probably rather want to do:

<ui:style>
.foo { font-weight: bold; }
</ui:style>
<gwt:Label addStyleNames="{style.foo}">bold</gwt:Label>

membersound

unread,
Jan 7, 2013, 8:47:00 AM1/7/13
to google-we...@googlegroups.com
Thanks for that comprehensive answer. Helps me alot!

RyanZA

unread,
Jan 7, 2013, 1:35:39 PM1/7/13
to google-we...@googlegroups.com
Hi Thomas

Do you know if there are any plans to move the gwt-* css styles into the CssResource system directly?
It's confusing to have all of the default GWT widgets use external styles when it's also recommended for users to use CssResource?
Reply all
Reply to author
Forward
0 new messages