You need to sign in to do that
Don't have an account?
Using Style Sheet on VF Page
I have the following text file I uploaded as a static resource:
.centertext { text-allign: center; }
I am using the tabbed account and I have a controller extension that exposes some lists (because I want to split a custom object into 3 tabs based on record type.) I am trying to center 2 of the columns in the below section of the VF page (Base Members and Current Members) .. I added the reference at the top of the VF page to the static resource as follows:
<apex:page standardController="Account" extensions="EnrollmentAcctExt" showHeader="true" tabStyle="account" standardStyleSheets="false"> <apex:stylesheet value="{!URLFOR($Resource.AccountStyle, 'AccountStyle.css')}"/>
and here is my pageblock that brings in the listing... however, the base members field is not centering:
<apex:tab label="Health Enrollment" name="HealthEnrollment" id="HE" styleclass="AcctListStyle"> <apex:pageBlock mode="edit" title="Health Enrollment Current"> <apex:form > <apex:commandButton action="{!NewEnrollHealth}" value="New"/> </apex:form> <apex:pageblockSection id="key" title=""> <apex:pageblockTable value="{!healthsummaryactive}" var="hs"> <apex:column headervalue="Health Enrollment Name"> <apex:outputLink value="/{!hs.id}">{!hs.Name}</apex:outputLink> </apex:column> <apex:column headervalue="Year"> <apex:outputField value="{!hs.Year__c}"/> </apex:column> <apex:column headervalue="Market"> <apex:outputField value="{!hs.Market__c}"/> </apex:column> <apex:column headervalue="Category"> <apex:outputField value="{!hs.Category__c}"/> </apex:column> <apex:column headervalue="Status"> <apex:outputField value="{!hs.Status__c}"/> </apex:column> <apex:column headervalue="Base Members"> <apex:outputField value="{!hs.Base_Members__c}" styleClass="centertext"/> </apex:column> <apex:column headervalue="Current Members"> <apex:outputField value="{!hs.Current_Members__c}"/> </apex:column> </apex:pageblocktable> </apex:pageblockSection> </apex:pageblock>
Do I have something in the wrong place or is my css file wrong? Any help is greatly appreciated!!!! Thanks!!
Fred
can you change the apex:stylesheet tag as follows and try
Current tag:
<apex:stylesheet value="{!URLFOR($Resource.AccountStyle, 'centertext.css')}"/>
Change to:
-Suresh
All Answers
Dear Fred;
I found spelling mistake with your centertext class.
try with
-Suresh
Thanks for responding... I still cannot get this to work... any help is greatly appreciated!!!
Fred
Move
to apex:column. Like this:
Thanks for your help... that is still not working... here is the entire VF page: Thanks again!!!
can you change the apex:stylesheet tag as follows and try
Current tag:
<apex:stylesheet value="{!URLFOR($Resource.AccountStyle, 'centertext.css')}"/>
Change to:
-Suresh
In my opinion, something is wrong(text-align:center;) in style sheet so change it in css text file. You can call text file from static resource directly on page by <apex:stylesheet value="{!($Resource.AccountStyle)}"/>
Hope this helps.
Thanks so much to both of you!!!! I did not understand that you only reference the file in the resource ... Thanks again!!!!!
Fred