Adding a Class to Category

Need custom styling for a specific Joomla category? Adding a class to a category lets you apply unique styles or behaviors to articles within it. It’s a simple way to enhance layout control and tailor the design to your content.

HTML code

<div class="category-<?php echo $this->category->id; ?>">....</div>

CSS code

div.category-2 .contentheading {color:pink}

This will give you wrapper classes of "category-2", "category-3" etc, where the numerical value is equal to the category ID in the back-end, you can then style up the individual elements.

Related Articles

Boki

Boki

With more than 15 years of hands-on experience in Joomla, the author specializes in building and redesigning websites that are both functional and easy to use. Driven by a passion for clean code and thoughtful design, they help individuals and businesses bring their digital ideas to life—turning concepts into smooth, engaging online experiences.

About

Saint Art Designs is a freelance Joomla web developer specializing in modern, responsive, and secure websites.

  • Joomla Web Development Service
  • Joomla Web Design
  • Joomla Upgrade
  • Joomla SEO

Why Hire Me?

With over two decades of experience in Joomla development, I deliver high-quality, stable, and scalable websites.

Each project is approached with precision, clear communication, and a focus on long-term value.

Get a Quote

Online Profiles

Freelancer
Upwork
Linkedin
Facebook
Google Review

Contact Info