How to Add a Class to a View

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:04
    Finally, it's possible to add one or more
  • 0:07
    custom CSS classes to the wrapper of the entire View.
  • 0:11
    To do this, we'll go to Advanced, CSS Class and enter the name of our class.
  • 0:17
    Let's take a quick look at how to do this now.
  • 0:20
    In our View of Recent Articles, I've toggled open the Advanced section,
  • 0:25
    and in the Other section, there is this CSS class, I'll click on None
  • 0:29
    and now I can add my custom class which will be latest-posts.
  • 0:34
    I'll "Apply (all displays)" and save the View. Now if I inspect this View,
  • 0:42
    and go up to the opening tag for my View, I have the default classes,
  • 0:47
    but I now have my custom class of latest-posts.
Loading ...