PDA

View Full Version : How to set the font size for a text box in GXT



nihilultra
4 Feb 2012, 10:31 AM
Hi,
I am trying to make a text box with rounded corners and a background image. Since the TextBox was not taking the SetStyle with the app.css file, finally I modified the gwt-all.css file with the following changes.

.x-form-text,textarea.x-form-field {
color: red;
margin: 0px;
font-size: 24px;
font-style: bold;
font-family: Arial;
background-image: url(../../images/TextBox.png)!important;
}


Finally I got it to take an image with rounded corners. However I am not able to set the font size , only the font color. Anyone, any ideas on how to set the style for a text box.

dhruv88esh
6 Feb 2012, 12:39 AM
Make your own css like:



.textAreaFontSize{
color: red !important;
font-size: 24px !important;
font-style: bold !important;
font-family: Arial !important;
}

then call it using


textArea.setStyleName("textAreaFontSize");

Don't make changes in gxt-all.css. It is better to write own css using !important.

Hope it may help you. :)

nihilultra
6 Feb 2012, 11:14 AM
Thanks Dhruv88esh. That worked :). I think I can safely assume at this point that !important is used to override the default settings in the main css file.