Skip to content

A responsive template changes its layout to fit the screen, from a wide monitor down to a phone. This guide builds one for Joomla 5 or Joomla 6, and ends with when it makes more sense to buy one.

What Joomla gives you

Joomla 5 and Joomla 6 ship with Bootstrap 5, and Cassiopeia, the template that comes with Joomla, is responsive out of the box. Your template doesn't have to use Bootstrap, but it's already there if you want its grid.

Step 1: Set up the template folder

A site template needs two files to start with, in templates/yourname/:

  • templateDetails.xml: the template's name, version, files and module positions.
  • index.php: the page itself.

Put your CSS, scripts and images in media/templates/site/yourname/. That's where Joomla looks for them.

Step 2: Add the viewport tag

Without it, phones draw the page at desktop width and shrink it. Put this in the head of index.php:

<meta name="viewport" content="width=device-width, initial-scale=1">

Step 3: Print a position only when it has modules

This lets the main column widen when the sidebar is empty, which is what people mean by collapsible positions:

<?php if ($this->countModules('sidebar')) : ?>
    <aside class="sidebar">
        <jdoc:include type="modules" name="sidebar" style="none" />
    </aside>
<?php endif; ?>

Step 4: Write the CSS for phones first

Start with one column, then add columns as the screen gets wider:

.page { display: grid; gap: 1.5rem; }
@media (min-width: 992px) {
    .page { grid-template-columns: 3fr 1fr; }
}

Step 5: Make images and menus behave

  • Set max-width: 100% and height: auto on images so that they never overflow.
  • Give images a width and height, so the page doesn't jump as they load.
  • Turn the top menu into a button on small screens, and make sure submenus work by tap, because there's no hover on a phone.
  • Keep buttons and links big enough to tap.

Step 6: Test on real screens

Your browser's device view is a good start, but also try a real phone. Look for sideways scrolling, wide tables, text that's too small, and forms that are hard to fill in. On a shop, add a product to the cart and go through checkout.

Or start from a finished design

All of this takes time, and it's the easy part of a template. If you'd rather edit than build, our Joomla 6 templates and Joomla 5 templates are already responsive, and they use plain Joomla modules with no page builder. Open a live demo on your phone, such as Xeno, Simplex or, for a shop, Bike Store.

Browse the templates · See the Template Club