+ Start a Discussion
reshmareshma 

setting background to visual force page

Hi I want to set background to visual force page(or form).
<apex:page bgcolor="blue">
 
<apex:form bgcolor="blue">
 
are not working even the attributes background ia not working.
 
Can anyone give me a way how to do it.
 
Thanks in advance
 
 
Jon Mountjoy_Jon Mountjoy_
I've just started playing with this myself.  One approach is to switch off all default styles, and use your own.  For example, I've created the following Visualforce page:


<apex:page standardStylesheets="false" showHeader="false" >

<apex:stylesheet value="{!$Resource.mystyle}"/>
<h1 class="myStyle">Congratulations</h1>



<apex:pageBlock title="Block Title" >
<apex:pageBlockSection title="Block Section Title">
foo
</apex:pageBlockSection>
</apex:pageBlock>

</apex:page>

And I uploaded the following style sheet as a static resource (and gave it a name "mystyle"):

Code:
body  {
background-color: #236FBD;
}

.pbTitle {
background-color: yellow;
}
.myStyle {
background-color: red;

}


The result is a pretty ugly, but colourful, page - with a blue background.  You'll notice that I use the .pbTitle class - that is a style classname generated by Visualforce by default for all page block titles etc.  You can dig around the standard styles ( see dCSS/Theme2/default/common.css ) to learn more about the standard class names, and modify/create your own.
 

(2008-May-28 Modified to use static resources properly)



Message Edited by Jon Mountjoy on 05-27-2008 11:58 PM
reshmareshma
Thanks jon it worked fine
virenviren

Hi,

 

If we set the shoeHeader to true( <apex:page showHeader="true">) then background colaor of page is not working.
How to resolve this.