How to center caption in Tree component ?

I have a Tree and I want to center the header caption.

Tree myt = new Tree();
myt.setCaption(“My Header”);

And I add menu items to this tree

Can I center the caption ?
Should I have to use css ? how?

Hi,

You could try something like this in CSS (I also did tree.setStyleName(“mytree”) in java):

.v-caption-mytree .v-captiontext {
	text-align: center;
	float: none;
}

Best Regards,
Marc