html - 更改 <p :menubar> CSS into RTL

标签 html css jsf primefaces

enter image description here

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="rtl" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <head>
        <title>IGNORED</title>    
    </head>
    <style type="text/css">
        .ui-menu-child{
            left: -60px; width: 8.5em; // or anything you want
        }
    </style>
<body>
    <ui:composition>  
        <h:outputScript name="header.js" library="js" target="head"/>
        <p:menubar id="mnubr_main" style="font-size: 75% !important;">
            <p:submenu styleClass="bmnu_karkard" id="sbmnu_karkard" label="#{msg.karkard}" style="float: right;">  
                <p:menuitem value="#{msg.khodrohaye_sabok}" url="../../../pages/karkard/sabok" style="float: right;"/>  
                <p:menuitem value="#{msg.khodrohaye_sangin}" url="../../../pages/karkard/sangin" /> 
                <p:menuitem value="test1" url="../../../pages/tarefe" /> 
            </p:submenu>

            <f:facet name="options" class="ui-float-left" id="haha"> 
                <p:commandButton id="btn_exit" title="#{msg.exit}"
                                 icon="ui-icon-exit" style="float: left; margin-right: 5px;"
                                 actionListener="#{userController.logout}" 
                                 oncomplete="handleRedirectRequest(xhr, status, args)"/>
                <p:outputLabel value="#{userController.selected.specification.name}" style="margin-top: 5px;"/>
            </f:facet>
        </p:menubar>
        <p:spacer height="20px"/>
    </ui:composition>
</body>

我使用样式来更改 .ui-menu-child 的位置但不更改 .ui-menu-child 的显示弹出面板。

<style type="text/css">
    .ui-menu-child{
        left: -60px; width: 8.5em; // or anything you want
    }
</style>

我试试这个

<style type="text/css">
    bmnu_karkard .ui-menu-child{
        left: -60px; width: 8.5em; // or anything you want
    }
</style>

我使用 this方式,但它不起作用。如何更改 primefaces 子菜单的弹出面板的样式?

最佳答案

您可能需要添加 !important 样式,试试这个:

<style type="text/css">
   .ui-menubar{       
       float: right !important;           
       margin-left: 0px !important;        
   }
   .ui-menu-list {
       right: 0;
   }
   .ui-menuitem-text {
       float: right !important;
   }
</style>

enter image description here

另请参阅:

关于html - 更改 <p :menubar> CSS into RTL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20709450/

相关文章:

model-view-controller - JSF:依赖于另一个 Controller 的 Controller ?

http - web.xml 中的错误页面配置会转换 404 情况下返回的 HTTP 代码

html - 我的导航栏在 FF 中的位置不正确

javascript - 仅在页面刷新后加载 Jquery 脚本

html - 特定元素在 IE 和 Chrome 中正确定位,但在 Firefox 中不正确......我不明白为什么?

javascript - 使用带有部分 ID 名称的 document.getElementById

JSF 2.0 : Limit value of h:outputtext to a specific number of characters

javascript - 检查 JavaScript 中的 CSS 值

html - 移动设备上的关键帧展开页面

html - 您如何在页面上拉伸(stretch)页眉、内容和页脚颜色,并且所有内容都以固定宽度居中?