【问题标题】:Relative positioning one element in the center and one on the right [closed]相对定位一个元素在中心和一个在右边[关闭]
【发布时间】:2014-02-18 06:32:52
【问题描述】:

我有一个数据表,在标题中我有:

  -The name of the table
  -A button 

我希望名称显示在中间,按钮显示在右侧。

<p:dataTable widgetVar="liveResizeTableWdg"
            var="c"
            value="#{errorContractBean.getDataList(loginBean.usernameLoggedOn)}"
            paginator="true" 
            rows="33"
            paginatorPosition="bottom"
            currentPageReportTemplate="Showing {startRecord}-{endRecord} out of {totalRecords}, 
            Page: {currentPage}/{totalPages}, 
            Total: #{errorContractBean.dataListSize}"
            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
            rowKey="#{c.uniqueRowID}"
            selection="#{errorContractBean.selectedContract}"
            selectionMode="single" 
            scrollable="true" 
            scrollWidth="auto"
            scrollHeight="auto"
            filteredValue="#{errorContractBean.filteredContracts}"
            resizableColumns="true" 
            liveResize="true" 
            id="liveResizeTable"
            sortMode="single"
            styleClass="table" 
            headerClass="table-header"
            rowStyleClass="rowDef"
            lazy="true">



            <f:facet name="header">
                <span style="font-size: 1.5em; color: red;">Error Transactions</span>
                <p:commandButton value="Refresh" actionListener="#{errorContractBean.refreshPage}" 
                        update=":form" style="position:relative;" oncomplete="liveResizeTableWdg.filter(); liveResizeTableWdg.clearFilters();"> 
                </p:commandButton>  
            </f:facet>

现在名称和按钮都出现在中间:

表:

-------------------------------------------------- ---------------------- ......................... 表格名称 - 按钮 -------------------------------------------------- ----------------------

我想要这个:

-------------------------------------------------- ---------------------- ...................... 表的名称...................... .... 按钮 -------------------------------------------------- ----------------------

我希望位置是相对的,因为当我缩小窗口时,按钮 必须按照页面。 如果我尝试在 css 中指定左或右,则 2 个元素不遵循 页面大小。

【问题讨论】:

  • 已经尝试在按钮上使用style="float: right;"
  • 不,我试试谢谢你的回复

标签: html css jsf-2 primefaces


【解决方案1】:

我确实通过以下方式更改了按钮:

<p:commandButton value="Refresh" actionListener="#{errorContractBean.refreshPage}" 
                        update=":form" style="float: right;" oncomplete="liveResizeTableWdg.filter(); liveResizeTableWdg.clearFilters();"> 
</p:commandButton>  

而且表格的样式有

overflow: visible

【讨论】:

    【解决方案2】:

    您是否已经尝试在按钮上使用style="float: right;"

    【讨论】:

    • 抱歉,在 google chrome 上工作正常,但在 firefox 上,即它在按钮下添加了一个空格 :((((
    • 我通过 oveflow visibile 解决了
    • @Frank,我建议您自己打开一个答案,而不是接受一个不能解决您的问题的答案。
    • 投反对票?我不明白。这最初是一条评论,然后根据操作请求,已成为答案。
    • @LaszloPapp 答案部分正确我在评论中写了正确答案的另一部分:oveflow visibile!有什么问题?
    猜你喜欢
    • 2013-08-12
    • 2012-06-24
    • 2013-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-27
    • 1970-01-01
    相关资源
    最近更新 更多