2013-10-09 56 views
2

我想實現一個簡單的VF標籤式界面。我已經上傳包含背景圖片裏面的「圖片」文件夾和所需的CSS一個zip文件作爲visualforce背景圖像不顯示

 <style type="text/css">body { background-image: url("images/back.jpeg") } 

以下是我如何實現的。

<apex:page id="thePage" sidebar="false" showHeader="false" tabstyle="Invoice_Statement__c"  standardController="Invoice_Statement__c" standardStylesheets="false"> 
    <apex:image url="{!$Resource.header}" width="1250" /> 
    <apex:stylesheet value="{!URLFOR($Resource.myStyles, 'styles.css')}"/> 
    <style type="text/css"> 
    p { background-color: ;} 
     tabPanel{ background-color:blue;} 
     .activeTab {background-color: #236FBD; color:white; background-image:none} 
     .inactiveTab { background-color: lightgrey; color:black; background-image:none} 
    </style> 

    <apex:tabPanel switchType="client" selectedTab="name1" id="theTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab"> 
    .. 
    .. 
    .. 
    </apex:tabPanel> 
    </apex:page> 

我的問題是背景不顯示。我跟着這個鏈接 - >http://www.salesforce.com/us/developer/docs/pages/Content/pages_styling_custom.htm 我用

<apex:image url="{!$Resource...}" width="1250" /> 

及其工作正常,但我無法得到的背景圖像我的應用程序。有什麼建議麼?

在此先感謝 甲硝唑

+0

ps:salesforce.stackexchange.com非常歡迎Salesforce特定問題! –

+1

Thnx提示@Sdry。我當天加入並且喜歡它。 – MnZ

+0

我注意到了:-) –

回答

2

這不是比你如何指的存儲在靜態資源的樣式太大的不同。

<apex:stylesheet value="{!URLFOR($Resource.myStyles, 'styles.css')}"/> 

你必須通過同樣的原理去加入旅遊CSS引用靜態資源。關鍵點在於,您的樣式聲明需要位於VF頁面上,以便它由force.com服務器呈現。假設您的圖像forlder是在myStyles zip文件作爲靜態資源:

<style type="text/css">body { background-image: url("{!URLFOR($Resource.myStyles, 'images/back.jpeg')}") } 
2

在你的CSS文件(靜態資源內)添加「../」圖像之前,並添加一些樣式:

body { 
background: url("../images/back.jpeg") no-repeat top fixed; 
background-size: 100%; 
}