【问题标题】:GWT PushButton image/text alignmentGWT PushButton 图像/文本对齐
【发布时间】:2012-02-05 15:56:59
【问题描述】:

我正在尝试创建带有自定义颜色和图像/文本的按钮。添加颜色和图像/文本非常容易,但现在我遇到了垂直对齐问题。 "text-alignment: center" 帮助我进行水平对齐,但在垂直方面没有运气。

<ui:style>
    .gwt-b {
        margin: 50px;
        height: 23px;
        width: 60px;
        color: #fff;
        font-size: 12px;
        font-family: arial, sans-serif;
        text-align: center;
        vertical-align: middle;
        background: -webkit-linear-gradient(top,#4d90fe,#357ae8);
        border: 1px solid #3079ED;
        outline-color: #3079ED;
        outline-width: 3px;
    }
</ui:style>

<g:HorizontalPanel>
    <g:PushButton ui:field='pushButton' enabled='true' addStyleNames="{style.gwt-b}">
        <g:upFace image="{res.search}">
        </g:upFace>
    </g:PushButton>

    <g:PushButton ui:field='pushButton2' enabled='true' addStyleNames="{style.gwt-b}">
        <g:upFace>
            <b>click me</b>
        </g:upFace>
    </g:PushButton>
<g:HorizontalPanel>

这是我得到的:

【问题讨论】:

    标签: css gwt uibinder


    【解决方案1】:
    .gwt-b {        
        ...
        line-height: 12px;
        ...
    }
    

    【讨论】:

    • 对文本有帮助,但对图像没有帮助
    【解决方案2】:

    IE8+

    .gwt-b {
        ...
        display: table-cell;
        vertical-align: middle;
        ...
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-10-06
      • 1970-01-01
      • 2022-06-15
      • 1970-01-01
      • 1970-01-01
      • 2019-05-14
      • 2011-01-14
      相关资源
      最近更新 更多