How to add a media type to drupal_add_css in custom module I’ve got a question about adding CSS to a custom module.

Originally I’ve been given this line:

link rel="stylesheet" type="text/css" media="screen and (max-width: 640px)"    href="mobile.css"


And I’ve converted it into:

drupal_add_css(drupal_get_path('module', 'savingsscore') . '/css/mobile.css', 'screen and          (max-width: 640px');


The file is being attached, but the media setting is wrong and I don’t know what it should be. I’m in Drupal 6.

Thanks!
drupal_add_css() is defined as:

drupal_add_css($path = NULL, $type = 'module', $media = 'all', $preprocess = TRUE)


and in your example, you are doing:

drupal_add_css(drupal_get_path('module', 'savingsscore') . '/css/mobile.css', 'screen and          (max-width: 640px');


which appears to have two problems:


You are skipping the $type argument,
You aren't closing the max-width parenthetical.


I'd suggest trying:

drupal_add_css(drupal_get_path('module', 'savingsscore') . '/css/mobile.css', 'module', 'screen and (max-width: 640px)');


and seeing it that fixes things up.