How to center an Image?

34 views
Skip to first unread message

membersound

unread,
Jan 7, 2013, 6:46:00 AM1/7/13
to google-we...@googlegroups.com
How can I center an image using uibinder?

This is what I tried and does not work:

.myImage {
    horizontal-align: bottom;
      vertical-align: bottom;
    text-align: bottom;
}


<g:SimplePanel styleName="{style.myImage}">
<g:Image styleName="{style.myImage}"/>
</g:SimplePanel>

Benjamin Possolo

unread,
Jan 7, 2013, 7:49:40 AM1/7/13
to google-we...@googlegroups.com
an <img> element is, by default, an inline element (as opposed to a block element).
That means you can simply use the following css property to center it:

.myImage {
text-align: center;
}

<g:SimplePanel>
<g:Image styleName="{style.myImage}"/>
</g:SimplePanel>

the image will be centered within the simple panel.
Reply all
Reply to author
Forward
0 new messages