function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anand Jeevakan 5Anand Jeevakan 5 

Is it possible to apply CSS styles to text inside the data table?

<apex:stylesheet value="{!$Resource.relatedList}" />
....
<apex:pageBlock title="Assessment Service Area">
  <apex:pageBlockTable value="{!getASAList}" var="asmtServiceArea">
    <apex:column styleClass = "link" value="{!asmtServiceArea.Name}" />
    <apex:column styleClass = "link" value="{!asmtServiceArea.Service_Area__c}"/>
    <apex:column styleClass = "link" value="{!asmtServiceArea.Service_Area_Level__c}"/>
    <apex:column styleClass = "link" value="{!asmtServiceArea.Minutes__c}"/>
  </apex:pageBlockTable>

I tried CSS file stored in Static resource as well as inline stylesheet, but the styles are not reflected in the text inside the table columns. Please help!
Karan Khanna 6Karan Khanna 6
You can refer this and modify as per your need:

<apex:page standardController="Account" standardStylesheets="false" showHeader="false">
    <head>
        <style type="text/CSS">
            body{
                font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;         
            }

            .center{
                text-align:center;
            }

            .table-bordered {
                border: 1px solid #000;
                border-collapse : collapse;
                font-size : .7em;
            }


           thead>tr>th {
                vertical-align: bottom;
                border: 1px solid #000;
                border-spacing: 0;
                text-align:center;
                border-collapse: collapse;
                background : #202d79;
                color:white;
            }

            td {
                vertical-align: bottom;
                border: 1px solid #000;
                border-spacing: 0;
                border-collapse: collapse;
                text-align:center;
            }

            .header>td{
                font-weight:bold;
                background : #c4c4c4;               
            }

            .echoArea>td{
                padding:10px;
            }

        </style>
    </head>
    <body>
        <p>
            <h3 class="center" style="text-decoration:underline">My Contacts</h3>
        </p>


        <table width="100%" class="table-bordered">
            <thead>
                <tr>
                    <th> Name</th>
                    <th>First Name</th>

                </tr>
            </thead>
            <tbody>
                <apex:repeat value="{!Account.Contacts}" var="con">

                        <tr>
                            <td>{!con.Name}</td>
                            <td>{!con.FirstName}</td>

                        </tr>

                </apex:repeat>
            </tbody>
        </table>

    </body>
</apex:page>


Anand Jeevakan 5Anand Jeevakan 5
Hi Karan,
Thank you.
But the code you posted do not have styles for texts within the <TD>.
I need the styles to be implemented for the texts displayed in the cell. Any suggestions will be helpful.
Karan Khanna 6Karan Khanna 6
I guess below is something you are seeking:

td {
                vertical-align: bottom;
                border: 1px solid #000;
                border-spacing: 0;
                border-collapse: collapse;
                text-align:center;
                // add your style for text
      }
Anand JeevakanAnand Jeevakan
Hi Karan,

I missed few points in my first post.
1. I'm rendering the VF page as PDF
2. I'm trying to change the appearance of the links that are displayed in related list. 
3. The PDF prints them in blue color and underlined them.

I used similar to the one you suggested:
.link
{
a:link {color: black;
text-decoration: none;}
a:visited {color: black;
text-decoration: none;}
a:hover {color: black;
text-decoration: none;}
a:active {color: black;
text-decoration: none;}
}

It did not work. I'm not sure if there is any solution exits for this. Hence I'm moving to Conga Composer. 
Thanks for your time and help.