css - 如何使用 GWT 2.4 对带边框的小部件进行垂直布局?

标签 css gwt alignment uibinder

我正在使用 GWT 2.4 和 uiBinder。

我试图让页面中心的一组小部件与单个外边框垂直对齐。我认为这会相当容易,但我需要在页面中心使用垂直布局来对齐小部件。

小部件使用垂直面板按我想要的方式排列,但没有可用的边框选项,除非我想使用 borderwidth 属性在每个元素周围放置边框。

这是 uiBinder 代码:

<g:HTMLPanel ui:field="mainPanel">
         <g:VerticalPanel ui:field="verticalPanel" styleName="{style.center}">
                        <g:Label ui:field="titleLabel"></g:Label>
                        <g:Label ui:field="loggedInUserLabel" text="You are logged in as: "> </g:Label>
                        <g:Label ui:field="userNameLabel" styleName="{style.spacer-bottom}"></g:Label>

                        <g:FormPanel ui:field="formPanel" styleName="{style.spacer-bottom}">
                        <g:FileUpload ui:field="fileUpload"></g:FileUpload>
                        </g:FormPanel>

                        <g:Label ui:field="Label" text="Please select:"></g:Label> 

                        <g:ListBox ui:field="ListBox" styleName="{style.spacer-bottom}" visibleItemCount='5'> 
                            <g:item value="-1">-- Please select item(s) below: --</g:item>
                        </g:ListBox>

                        <g:Button ui:field="Button" styleName="{style.button}" text="Calculate"></g:Button> 

                        <g:HorizontalPanel ui:field="horizontalPanel"  styleName="{style.spacer-top}">
                            <g:cell width='5em' horizontalAlignment="ALIGN_LEFT">
                                <g:Button ui:field="cancelButton" styleName="{style.exitcancelbutton}"  text="Cancel"></g:Button>
                            </g:cell>
                            <g:cell width='5em' horizontalAlignment="ALIGN_RIGHT">
                                <g:Button ui:field="exitButton" styleName="{style.exitcancelbutton}" text="Exit"></g:Button>
                            </g:cell>                   
                        </g:HorizontalPanel>
                </g:VerticalPanel>
    </g:HTMLPanel>

我是不是设计错了,我的意思是使用错误的面板来实现我想要做的事情?

最佳答案

您可以为 verticalpanel 的 borderwidth 设置边框,这样所有添加到它的小部件都会显示为好像它有边框一样。

关于css - 如何使用 GWT 2.4 对带边框的小部件进行垂直布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8244240/

相关文章:

javascript - 悬停时暂时偏离 CSS 动画,然后恢复

file - 在 GWT 项目中写入文本文件?

java - 将 GWT RequestFactory 与 Grails 一起使用时的类加载器问题

java - 从 gwt 调用 javascript 抛出 undefined is not a function

Html 表格右对齐

javascript - 调整网站的所有文本和背景以实现对比度(对比度交换器)ADA WCAG 合规性

css - 为什么删除后css仍然应用?

css - 垂直对齐 img

html - firefox 不显示 html 文件的样式

string - 字符串 B 在 A 的子字符串中的最佳对齐方式 -- 生物信息学