Is it possible to add custom HTML and CSS in views header and footer using the administrative UI? I am trying to add a header to my view but that is not giving me any option through which I can add HTML and CSS like the options which are given to us when we add fields in views. I have tried adding a header using Global Textarea but in this, we can only write HTML not CSS. Kindly tell how can we add HTML and CSS both to the header.


1 Answer 1


It isn't good practice to intermix HTML and CSS (embed CSS or use inline styles). As a rule CSS is kept separate in files in your theme, and some in modules.

Views allows you to define CSS classes for certain parts of the output, but you still have to keep the CSS rules and declarations in your theme.

If you don't have access to your subtheme for some reason or only want to apply tiny changes you can try CSS Editor. It gives you a place where to enter new CSS rules that will apply throughout your theme.

You still have to edit your Views output to include the custom HTML classes to elements you want to style, you can do that through Global Text area as you already found.

Many themes already assign a lot of classes to various Views parts, so maybe you already have classes relevant to your design and you can use them in custom CSS without adding new classes in HTML.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.