Centering text in a Label

1,347 views
Skip to first unread message

ph09

unread,
Sep 8, 2011, 6:33:43 AM9/8/11
to Google Web Toolkit
Hello,

I try to centering text in a Label with following CSS:
.gwt-Label-1 {
border: 1px solid;
font-size: 13px;
vertical-align: middle;
text-align: center;
background-color: lavender;
}

It works all except of "vertical-align: middle". The text is always at
the top of the Label.
Does anyone know why?

István Szoboszlai

unread,
Sep 8, 2011, 6:48:08 AM9/8/11
to google-we...@googlegroups.com
This is a quiet big problem.
It is very hard to center things verically in a browser independent way. You should try googling for it.
There are a few not very straight forward solutions.

This issue is not related to GWT.

Üdvözlettel / Best Regards
- István Szoboszlai
istvan.s...@inepex.com | inepex.com



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Sudhakar Abraham

unread,
Sep 8, 2011, 8:29:52 AM9/8/11
to Google Web Toolkit
To adjust the properties "padding-top","padding-bottom","padding-
right","padding-left" in Style Sheet, please see the following code.

.gwt-Label-1
{
border: 1px solid;
font-size: 13px;
padding-left:5px;
padding-right:5px;
padding-bottom:5px;
padding-top:5px;
background-color: lavender;
}

S. Abraham
www.DataStoreGwt.com

kalpana anbalagan

unread,
Sep 8, 2011, 8:45:18 AM9/8/11
to google-we...@googlegroups.com

CSS "line-height" property can be used to vertically align.
ex:
.gwtLabel{
 border: 1px solid red;
 font-size: 13px;
height: 300px;
line-height: 300px;
text-align: center;
background-color: lavender;
}

-Kalpana


skly

unread,
Sep 8, 2011, 7:12:50 AM9/8/11
to google-we...@googlegroups.com
Try this:
height:24px;
line-height:24px;

2011/9/8 István Szoboszlai <mrs...@gmail.com>
Reply all
Reply to author
Forward
0 new messages