css – PrimeFaces 2.2.1在本地看起来与展示柜不同

前端之家收集整理的这篇文章主要介绍了css – PrimeFaces 2.2.1在本地看起来与展示柜不同前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经看到类似的问题 herehere.这两个都没有回答我的问题.我也搜索PrimeFaces forum.

在NetBeans中设置一个香草JSF 2.0项目,我添加Simple Dialog的Showcase代码.

代码(index.xhtml)减去xml声明和DOCTYPE(XHTML 1.0 Transitional):

  1. <html xmlns="http://www.w3.org/1999/xhtml"
  2. xmlns:h="http://java.sun.com/jsf/html"
  3. xmlns:p="http://primefaces.prime.com.tr/ui">
  4. <h:head>
  5. <title>PrimeFaces</title>
  6. </h:head>
  7. <h:body>
  8. <h:panelGrid columns="1" cellpadding="5">
  9. <p:commandButton value="Basic" onclick="dlg1.show();" type="button"/>
  10.  
  11. <p:commandButton value="Modal" onclick="dlg2.show();" type="button"/>
  12.  
  13. <p:commandButton value="Effects" onclick="dlg3.show();" type="button"/>
  14. </h:panelGrid>
  15.  
  16. <p:dialog header="Basic Dialog" widgetVar="dlg1">
  17. <h:outputText value="Resistance to PrimeFaces is futile!" />
  18. </p:dialog>
  19.  
  20. <p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" height="200">
  21. <h:outputText value="This is a Modal Dialog." />
  22. </p:dialog>
  23.  
  24. <p:dialog header="Effect Dialog" widgetVar="dlg3" showEffect="bounce" hideEffect="explode" height="200">
  25. <h:outputText value="This dialog has cool effects." />
  26. </p:dialog>
  27. </h:body>@H_403_7@
  28. 我将aristo主题添加到我的Libraries(NetBeans添加到classpath中),并将以下内容添加到web.xml

  29. web.xml(部分):

  30. <context-param>
  31.     <param-name>primefaces.THEME</param-name>
  32.     <param-value>aristo</param-value>
  33. </context-param>@H_403_7@ 
  34.  

    没有其他更改,虽然我很快安装/卸载另一个主题(黑暗蜂巢),只是为了确保主题正在注册正确.结果如下:

  35.  

    本地(Chrome 15.0.874.92):

  36.  

    展示:(从PrimeFaces Showcase)

  37.  

    堆栈:
    PrimeFaces 2.2.1
    JSF 2.0
    玻璃鱼3.1.1
    Java 1.6.0_18
    Windows 7 x64
    (由NetBeans 7.0.1生成)

  38.  

    编辑:这也是在FireFox 7.0.1和IE 9上测试的

解决方法

默认字体大小不是问题吗?从 showcase css可以看出,它有自定义字体大小覆盖主题的默认值:
  1. body {
  2. margin: 0px;
  3. padding: 0;
  4. font-size: 12px;
  5. color: #616161;
  6. }@H_403_7@
  7. 我查了一些我的项目,他们都有一些font-size / font-family定制.希望有帮助

猜你在找的CSS相关文章