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..

    How to load CSS filed inside the body in JSP?

    How can I show an absolutely positioned div inside a fixed positioned div?

    Css accordion menu, how to set height to automatic?

    How to change and maintain multiple color themes at runtime with css?

    How do I make a class/div behave like it were floating?

    How do I change the Default Design? [closed]

    How to override a class using jquery

    how do I center this image, without touching the HTML

    How to use @page CSS in ASP.NET MVC View

    CSS - How to upscale Unicode arrows?

    How To Adjust CSS List On Hover Image

    How to make 2 level scrolling tab in CSS like this in HTML 5

    How to add css in django Updateview or Create view form

    Why does first slideshow image click skip transition and go straight to image?

    How to add bootstrap css to my Wordpress plugin

    How to change css for an element but keep defaults for it's children

    How to rotate an element around a line other than X=0,Y=0 and Z=0 using CSS3?

    How to find the place where font-size for input is set?

    How to do taxonomy based css styling using drupal template.php?

    How do I require main.css.erb in application.css

    How To Wrap A Div When Parent Container Shrinks Using CSS

    How to keep border inside to take ribbon over to div?

    How to align images side by side without spacing when grouped within another element

    Customizing Clockdown.js to Show only Minutes and Seconds

    How to truly align center of two elemnts with css?

    How to hide and retrieve a URL in CSS with Javascript

    Displaying XML using CSS: How to handle  ?

    How to fill vertical spaces between tiles in a grid system (Using CSS)

    How to “mark” a UL/LI nav item as “active” based on click?

    How can I force Visual Studio to follow a custom CSS template when I edit my css files?