Friday, February 27, 2015

Add custom CSS styles to XSLT List View webpart

To add custom css styles to xslt list view webpart follow these steps

  1. Create a new view on the list or document library
  2. Edit the view in sharepoint designer and generate custom xslt styles for the entire view
    • Open the view in Sharepoint designer
    • Click on Design tab
    • Click on Customize Entire View option





  1. Find this code 
  2. <xsl:template match="View" mode="footer">
      </xsl:template>


  3. Replace it with your styles embedded in it
  4. e.g.

    <xsl:template match="View" mode="footer">
    <style type="text/css">
    .ms-bodyareaframe {
    padding: 0px;
    }
    .ms-vh A:link, .ms-vb A:link, .ms-vb2, .ms-vh2 A, Nobr SPAN A:link, div.noindex table.ms-listviewtable tr.ms-viewheadertr th.ms-vh2 div.ms-vh-div,
    table.s4-wpTopTable div.noindex tr.ms-viewheadertr th.ms-vh2 div.ms-vh-div, td.ms-gb
    {
    color: green;
    text-decoration: none;
    font-family:&quot;Segoe UI&quot;;
    font-size:8pt;
    font-weight: normal;
    }
    .ms-viewheadertr, .ms-vhltr
    {
    background-color:silver;
    }
    </style> </xsl:template>


  5. Save and close Sharepoint designer 
  6. Refresh the view in browser

No comments:

SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error Turns out the fix was to simply e...