This is my first question on Drupal answers, so be kind to me :)

I'm fairly new to Drupal, and indeed web developing in general. I have been working on my first site for a few months now, learning as I go.

In the past month, I have figured out how to make my own sub-theme of the one I was using. I have been using the sub-theme to adjust the "little niggles" that I have with page formatting directly. So far, I have been doing this by adding little snippets of css to a .css file in the sub-theme - and trying to keep this file as DRY as possible.

This has been working well for me, but when reading around, all I see is discussion of modifying/using .tpl.php files, which is making me wonder if I'm missing something and/or setting myself up for major problems as this this .css file grows?

TL:DR What are the problems and/or disadvantages of using a single .css file to make styling adjustments on my drupal site?

  • Keep doing what you're doing if the markup of your theme suits you. CSS files and Template files both work with each other and interdependent on each other more or less.
    – Beebee
    Sep 8, 2015 at 15:44

1 Answer 1


If your real question is more along the lines of:

Should I make the CSS conform to the markup, or make the markup conform to the CSS?

Then that's just a judgment call, there's no right or wrong answer. Go with what you feel comfortable doing. Some people love the plethora of classes Drupal adds by default, some people hate it. Some people prefer the Bootstrap approach (class, class, class), some people prefer the Susy approach (as few classes as possible, ostensibly). Neither is right or wrong, just different.

Read on for answers to the specific posed questions...

When to use a tpl.php file instead of a .css file?

The literal answer to that is simply "never".

A CSS file and a template file are for different things, and contain different things. You wouldn't put markup in a CSS file, and you wouldn't put CSS in a template file (except perhaps in rare circumstances like if you were inlining the above-the-fold content or something).

What are the problems and/or disadvantages of using a single .css file to make styling adjustments on my drupal site?

There are no problems or disadvantages per se. It's arguably better to split your CSS into multiple files, simply for modularity's sake, but those are all going to be aggregated back into one when the site goes into production mode anyway (assuming the CSS you're talking about is "every page" CSS; you haven't mentioned otherwise).

Basically go with what feels comfortable, by your organisation's standards, or whatever general advice you find and like about organising CSS files. Drupal doesn't mind how you do it.

  • Many thanks for the full-some answer. It appears I hadn't quite appreciated the differences between the files (which is why I asked the question). At least there is no downside to what I am doing currently. I'm far from the level of using Bootstrap, or one of the "bare-bones" base themes, I guess I'll need to look into tpl files at that point?
    – Jabelpeeps
    Sep 8, 2015 at 16:50
  • You're welcome - the template files are used to control the HTML markup, so you only really need to look at those when the existing markup (for nodes, user profile pages, comments, etc) isn't what you'd like it to be. That might be driven by a need to style elements in a certain way using CSS, or maybe there's too much markup being produced and you'd like to slim it down, maybe you need to add microdata, and so on. Basically, if you're looking at some markup that a module or theme is outputting, and you're thinking "this needs to change", that's when you need to dive into a template file
    – Clive
    Sep 8, 2015 at 17:03
  • @Jabelpeeps Bootstrap is not really that great thing that most people make it out to be ;) I don't think it's future proof, plus it is already going old. Check this post about the downfalls of bootstrap on the discussion about including a new framework based theme in core on d.o if you feel like doing some reading ;)
    – Beebee
    Sep 8, 2015 at 21:12

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.