0

How do I style list items of a field output from a View.

By this I don't mean styling the overall list items that a view outputs but I mean the items of a list field in each of the content output.

To try to explain my question further:

  • I have a content type which has a list as one of the fields
  • content has being created using this content type
  • a view has been created to list each instance of the content
  • each content shows its list field, I have set this to output as an unordered list
  • I want to apply a CSS class to each of the list field of each of the content

In the Views 'configurator' ( admin/structure/views/(myview) ) pages, it allows adding CSS classes to wrapper markup and the fields of the output. However, it doesn't allow for applying classes the individual items of fields which are list items, i.e. the li html of each item of the list for a field which is a list.

I'm happy to do this in a template file for my theme, but have already attempted to create a .tpl file using information from "Theme: Information" in the View 'configurator' page (under the OTHER heading). There are many suggestions shown here but not all the base code .tpl files (for copying into your own theme and customising) are provided in the theme folder of the views module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.