I have a VF page in which I have a form (Total two forms) which includes a pageblock section. I want to change the background color of the form using CSS. How do I do it? I have tried creating a CSS class, and used that class in that particular form (Out of two forms that are in that page) but still unable to do so. Why?
I have to change the background color of the form 1 where there are input fields.How to achieve this functionality?
Code follows Here:
<apex:page Controller="IssueBook" id="abc" showHeader="false"> <style type="text/css"> .rules_form1 { background-color:#99dce4; font-size: 18px; font-family: Arial; margin: 10px 0 10px 30px; float: left; width: 100%; } .rules_form2 { font-size: 18px; font-family: Arial; margin: 10px 0 10px 30px; float: left; width: 100%; } body { background-color: white; width:80%;margin-left:auto;margin-right:auto; margin-top:10px;} </style> <apex:form styleClass="rules_form1"> <apex:pageBlock title="Book Request Form"> <hr size="1px" color="black"/> <apex:pageBlockSection columns="2" > <apex:inputField value="{!a.Book_Name__c}"/> <apex:inputField value="{!a.Author__c}"/> <apex:inputField value="{!a.Edition__c}"/> <apex:inputField value="{!a.Date_of_Issue__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="Bottom" styleClass="rules"> <apex:commandButton value="Save" action="{!saveBook}" reRender="BookList" oncomplete="this.form.reset();"> </apex:commandButton> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> <apex:form styleClass="rules_form2" > <apex:pageBlock id="BookList"> <apex:pageblockTable value="{!BookList}" var="ab" > <apex:column value="{!ab.book.Book_Name__c}"/> <apex:column value="{!ab.book.Author__c}"/> <apex:column value="{!ab.book.Edition__c}"/> <apex:column value="{!ab.book.Date_of_Issue__c}"/> <apex:column value="{!ab.book.Return_Date__c}"/> <apex:column > <apex:commandLink value="Delete" action="{!deleteBook}"><apex:param value="{!ab.selected}" name="selectedBook" /></apex:commandLink> </apex:column> </apex:pageblockTable> <apex:pageBlockSection ><apex:commandButton value="SUBMIT REQUEST" action="{!saveInDatabase}"/></apex:pageBlockSection> </apex:pageBlock> </apex:form>