adding simple divs

How would i go about adding a simple div element in a css layout. For instance:

public class MyLayout extends CssLayout {

public MyLayout() {
//addComponent(WHAT DO I PUT HERE?);


For instance, i would like to add just 1 div:

I need to do it without the framework adding additional extraneous divs around my div.



Use a plain Label component. That’s just one DIV on the client side, and you can set the classname of that DIV with Label.setStyleName(String)

public class MyLayout extends CssLayout {

public MyLayout() {
Label l = new Label();
l.setSizeUndefined(); // labels are 100% wide by default

But since I don’t know what you’re needs are exactly, this might be a totally useless approach.

How to nest another component inside the div ? Doesn’t seem that Labels take sub-components?

Nope, you can’t put components inside a Label. You can put HTML, though, if you specify the correct Content Mode. Maybe you want a
Custom Layout