Html 无法更改Primefaces p:commandButton字体属性
我需要一些自定义按钮在我的网站上,这看起来不同于其他。 我为这些按钮创建了一个css类,但它的行为很奇怪 这是一节课:Html 无法更改Primefaces p:commandButton字体属性,html,css,jsf,primefaces,Html,Css,Jsf,Primefaces,我需要一些自定义按钮在我的网站上,这看起来不同于其他。 我为这些按钮创建了一个css类,但它的行为很奇怪 这是一节课: .regCommandButton { color: #ffffff; background: #29b6a0; border-color: #23a38f; width: 100%; height: 25px; font-family: 'pluto_sansthin'; font-size:1.4em;
.regCommandButton {
color: #ffffff;
background: #29b6a0;
border-color: #23a38f;
width: 100%;
height: 25px;
font-family: 'pluto_sansthin';
font-size:1.4em;
}
在同一css文件中导入字体:
@font-face {
font-family: 'pluto_sansthin';
src: url(#{resource['fonts/plutosansthin-webfont.eot']});
src: url(#{resource['fonts/plutosansthin-webfont.eot?#iefix']}) format('embedded-opentype'),
url(#{resource['fonts/plutosansthin-webfont.woff']}) format('woff'),
url(#{resource['fonts/plutosansthin-webfont.ttf']}) format('truetype');
font-weight: normal;
font-style: normal;
}
html实现:
<p:outputPanel>
<p:commandButton styleClass="regCommandButton" value="Save" action="#{URBean.saveNewUser}" update="regPanel" />
</p:outputPanel>
我的问题是,如果按钮位于p:outputpanel
内,则没有设置与字体相关的属性(字体系列、字体大小)。所有其他的都适用于该按钮
如果我把按钮放在outputpanel外面,一切都会按预期进行
编辑:
使用!重要信息:字体属性对eather没有帮助。您可以解决此问题,将
.regCommandButton
替换为.ui button.regCommandButton
使用.ui按钮
和.regCommandButton
告诉taht,每个元素都具有所描述的特性:
.ui-button.regCommandButton {
color: #ffffff;
background: #29b6a0;
border-color: #23a38f;
width: 100%;
height: 25px;
font-family: 'pluto_sansthin';
font-size:1.4em;
}
你读了吗?@Ganser先生:是的,我读了,我相应地加载了我的样式表。在任何其他情况下,我都可以覆盖PF样式类。但是如果按钮的字体不起作用。
font-color
应该是color
不错的选择。它实际上解决了颜色问题。不幸的是,我仍然无法修改字体大小和字体类型。请将.regCommandButton
类替换为.ui button.regCommandButton
。如果它不起作用,试着检查按钮(我用chrome来做),你会看到span
css
类的p:commandButton
文本,也尝试一下。