How should I set a custom style on a object that is a gwt component?


Tags: java,html,css,gwt,web-development-server

Problem :

I am using Java (Eclipse) and for the web development I use gwt. The object that I want to change (loader) has a default font-size. It also has a method named setHtml(String). I have almst no knowledge on on HTML and CSS and how should I integrate such files in java code. I've been told that I should write something like: loader.setHTML("<span class = 'something>'" +.... ) What this something should be? Does it have to be an .css file and just the path to it?



Solution :

There are two ways to do that.

First, you can define the rule in CSS. You do need to learn HTML and CSS for web development - no way around that.

Second, you can set a particular CSS property directly in your code:

loader.getElement().getStyle().setFontSize(24, Unit.PX);

    CSS Howto..

    Show different text based on OS

    How to align the inside box to center of the table

    How to apply same event to multiple buttons?

    How to remove a CSS class from all same level table rows When a Row is Selected?

    How do i cover the rail of an Ajax Slider Extender when i move the handle from step 0 to step 50 and have those steps colored gray?

    How do I displaying a list of multiple objects, one below the other, in HTML using Django?

    How to make an interactive sidebar with jQuery and CSS3?

    How to get the position of element transformed with css rotate

    How to solve this HTML/CSS bug? [closed]

    how would I use Javascript, html and css to produce the running tiger effect seen in run4tigers website? [closed]

    How to have proper spacing between items in the navbar regardless of word size?

    How to use CSS in html table inside javascript

    jQuery show multiple image thumbnail before upload

    How to make sure Text always stays on top of Image (even when resizing)?

    How to vertical align element relative other element with pseudo-class? [duplicate]

    CSS stylesheets at top or bottom? or How to solve blank page issue?

    How can I fade in a div on hover with jquery on top of image with animated rollover

    how to specify a different image in css depending if the user visits on a desktop or a mobile browser

    CSS: How to center a bottom-fixed menu

    How to style a single QToolButton using qss/css

    How do you use CSS Selectors to select multiple elements? [duplicate]

    css breadcrumbs breaks into 2 lines, how to controll it in responsive?

    How to prevent inheritance of any css style of parent node to child node?

    How to crop Google GeoChart and center its content?

    How/where to center Items on Webpage

    How to underline blank space in CSS?

    How to delay Hide/Show events until Iframe loads after a submit

    CSS: how to position element in lower right?

    how to prevent vertical Stepdown

    FontAwesome icon showing as black box. What CSS is needed to display icon?