How do I style a List View Web Part?
Question
I've included a List View Web part on a page. I want to show a list of links. How do I style it? Such as changing the CSS, adding icons etc.
Solution
The question is a bit vague, only because there are quite a few ways to do, and doing an initial search you will find quite a few resources.
I will list out 3 possible methods for you:
- Edit the page with SharePoint Designer.
- Use a content editor and/or script editor web part on the page.
- Use display templates - in your list webpart properties there is an option at the bottom of the page to a link to a JSLink file. This is a JavaScript file that SharePoint will use to create a rendering template for your list view.
Which one should you use? It depends.
If you want to re-use the style, then look at #3.
If it's one off and you need a quick solution use #2
If you need the code to not be modified by a user with contribute permissions, and it's a one off look at #1
There are actually a few more advanced methods but these are the most common. I encourage you to look at Microsoft MSDN site regarding JSLink files - they provide quite a bit of power.