我正在尝试将CSS样式规则应用于Visualforce页面。我的最终目标是使用renderAs=" PDF“从页面生成一个pdf(这里没有包含它,因为我试图隔离这个问题)。
我曾尝试使用developer.force.com页面上的各种教程创建外部样式表,但都没有成功。这些样式表是通过静态资源添加到SFDC的,您可以从下面的代码中看到。但是,不会呈现样式。
我还尝试应用内联样式来测试,但同样没有呈现。
我正在使用API 33在我的组织中测试Sandbox PRO。我尝试了其他API版本,但得到了相同的结果。
有人能提供一些如何解决这个问题的线索吗?
<apex:page showHeader="false" applyHtmlTag="false">
<apex:stylesheet value="{!URLFOR($Resource.csstesting, 'qstyles.css')}"/>
<style type="text/CSS">
@page {
/* Landscape orientation */
size:landscape;
/* Put page numbers in the top right corner of each
page in the pdf document. */
@bottom-right {
content: "Page " counter(page) " of " counter(pages);
}
}
</style>
<apex:outputPanel layout="block" styleClass="standardBackground"/>
<apex:outputText style="background-color:#0000FF"><span>Hello</span> </apex:outputText>
</apex:page>发布于 2015-04-17 04:55:48
Salesforce将Visualforce页面作为HTML4.01提供服务。我不是html/css专家,但我认为这些指令可能只在HTML5中可用。尝试以下操作:
<apex:page showHeader="false" applyHtmlTag="false" docType="html-5.0">
有关更多信息,请参阅sfsx上的这个问题:https://salesforce.stackexchange.com/questions/4672/what-happens-if-i-use-html5-doctype-in-visualforce?rq=1
https://stackoverflow.com/questions/29678865
复制相似问题