I've got a module building/theming question I was hoping to get some help with today?

I'm building two custom modules that create their own pages to be displayed on. Adding CSS and JS though "drupal_add_css" and "drupal_add_js" has worked just fine. the problem I'm having is that the CSS/JS is not the last CSS/JS that gets added when the page is called. The theme css is still being called last and overriding some of my styles.

So my questions are: can I unset the theme css from the module for the page where my mod appears? is that the right way to do things? or would it be better practice to rename my IDs/classes where conflicts occur?

enter image description here Thanks!


1 Answer 1


The theme layer loads after your module has, so you won't be able to modify that part yet. I think you can just set the weight on your functions: http://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_add_js/7

Or just rename your ID's and classes to be specific to your module to reduce conflicts. I usually would name my ID's or classes nothing to generic, usually a shorthand for the name of the module then the name of the id or classes i want to reduce conflict.

  • I thought that too, unfortunately weight was only added as an option in Drupal 7
    – Clive
    Commented Jan 15, 2013 at 18:52
  • I think you're right, and I'll be renaming my IDs/Classes. One last question for you please, the "weight" from the function you listed. I'm in D6, and dont see anything about weight in that version. is there information about it that you can point me to? Thanks for the help!
    – StephanieF
    Commented Jan 15, 2013 at 18:54
  • that im not too sure of. Commented Jan 15, 2013 at 19:03

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.