【问题标题】:Extra space coming around h:inputTexth:inputText 周围有额外的空间
【发布时间】:2014-04-30 15:33:59
【问题描述】:

我有一个丰富的数据表列,如下所示:

<h:panelGrid columns="2" width="100%"
style="text-align: center;line-height:0px;">                                                

    <h:outputText value="*"                             style="font: bold 19px;color: red;position: relative;margin:0;padding:0;"
    rendered="#{s:isNotNumber(forecastList.rasMap[mapElements])}"></h:outputText>
    <h:inputText value="#{forecastList.rasMap[mapElements]}"
    readonly="true" onfocus="captureFocus(this,this.form);"
    size="15" 
    style="#{s:contains(forecastList.rasMap[mapElements],'-') ? 'color: red;' : ''};
    text-align: right; vertical-align: middle;background-color: white;margin:0;padding:0;"
    label="For #{forecastList.currencySymbolRas} - #{mapElements},">
    <s:bigDecimalConverter decimalDigits="2" />
    </h:inputText>
                                            </h:panelGrid>

但是我无法删除星号和输入文本框之间的空格。我希望它们彼此靠近。

【问题讨论】:

    标签: css jsf richfaces


    【解决方案1】:

    删除width="100%" 并(可选)在h:panelGrid 中添加其他属性:

    <h:panelGrid columns="2" border="0" cellpadding="0" cellspacing="0">
    

    【讨论】:

    • 感谢 Lukach 调查该问题。但我已经尝试过了...不走运!!
    • 你有更多的行(或者只有 1 行)?如果超过 1 个具有不同的文本,那么您可以从 h:panelGrid style 属性中删除 text-align: center 并为每列使用样式。
    • 其他重要的事情:删除h:panelGrid中的width="100%"
    【解决方案2】:

    试试这个:

    <h:outputText value="*" >
    </h:outputText><h:inputText ... />
    

    【讨论】:

    • 解释,除了正确的代码,总是很感激(和预期的,IMO)。
    • @JonathonReinhart:由于换行符很容易发现,我想为 OP 留下啊哈时刻:P。我以后会做得更好:D
    猜你喜欢
    • 2013-08-21
    • 1970-01-01
    • 1970-01-01
    • 2016-05-10
    • 2018-02-18
    • 2014-08-25
    • 1970-01-01
    • 2020-04-16
    相关资源
    最近更新 更多