According to the function:

function drupal_placeholder($text) {
  return '<em class="placeholder">' . check_plain($text) . '</em>';

It would return the HTML code with class "placecholder". I had searched the word "placeholder" in the drupal 7 project about 4,800 files. I expected to find the default CSS definition of class placeholder e.g. em.placeholder{} or .placehoder{}. But I can't.

I can only find some files with html ID attribute #placeholder{} was defined.

Some of the files:

Because I want to modify class with my style globally. Please advise if any default definition of class placeholder in drupal 7.

  • Why not just use the "placeholder" class in your CSS? – David Thomas Sep 30 '13 at 22:24
  • I want to know the default value of the placeholder class because I want to improve the false safe handling. In the best practice, the default value should be known before doing any override action. Define the "placeholder" class in my CSS would work properly and it can override default setting. But, I want to place safe to know the condition if my custom CSS was failed. Also, if possible, changing the default value would better option than doing override action. – Matt Oct 1 '13 at 6:47
  • No there's no default styling in Drupal core for an element with a .placeholder class – Clive Oct 1 '13 at 8:14

The only uses of the placeholder class in core are (filename, followed by line number, follby the line):

modules/dashboard/dashboard.js:35:        if ($('.placeholder', this).length == 0) {
modules/dashboard/dashboard.js:38:        $('.placeholder', this).html(empty_text);
modules/dashboard/dashboard.js:41:        $('.placeholder', this).remove();
modules/system/system.admin.css:264:.exposed-filters .current-filters .placeholder {

and also a few in jquery.ui that you can ignore:


You can safely ignore all this and just implement your own css for the .placeholder class in your theme.

  • Thank very much. I would define my own CSS without uncertainty now. – Matt Oct 1 '13 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.