diff --git a/core/includes/form.inc b/core/includes/form.inc
index 85bffc6..0f15136 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -3957,6 +3957,10 @@ function theme_form_element($variables) {
   if (!empty($element['#attributes']['disabled'])) {
     $attributes['class'][] = 'form-disabled';
   }
+  // If #title is not set or not visible we add a class for styling.
+  if (!isset($element['#title']) || ($element['#title_display'] != 'before' && $element['#title_display'] != 'after')) {
+    $attributes['class'][] = 'form-label-none';
+  }
   $output = '<div' . drupal_attributes($attributes) . '>' . "\n";
 
   // If #title is not set, we don't display any label or required marker.
diff --git a/core/modules/simpletest/tests/form.test b/core/modules/simpletest/tests/form.test
index 784da88..cebd811 100644
--- a/core/modules/simpletest/tests/form.test
+++ b/core/modules/simpletest/tests/form.test
@@ -1628,3 +1628,64 @@ class FormCheckboxTestCase extends DrupalWebTestCase {
     }
   }
 }
+
+/**
+ * Tests adding a .form-label-none CSS class at the forms with no or no visible <label>
+ */
+class FormLabelNoneTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
+
+  public static function getInfo() {
+    return array(
+      'name'  =>  'form-label-none CSS class',
+      'description' => 'Tests adding a .form-label-none CSS class at the forms with no or no visible <label>',
+      'group' => 'Form API',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('form_test');
+  }
+
+  function testCssClass() {
+    $form = array();
+    $form['textfield'] = array(
+      '#type'   =>  'textfield',
+      '#title'  =>  'textfield example',
+    );
+
+    // Possibles #title_display values with one exception the "without_title" key
+    // remove the title at the form
+    $tests = array(
+      'invisible' => TRUE,
+      'none' => TRUE,
+      'attribute' => TRUE,
+      'without_title' => TRUE,
+      'unknow_value' => TRUE,
+      'before' => FALSE,
+      'after' => FALSE,
+    );
+
+    foreach ($tests as $title_display => $expected) {
+      $tmp = $form;
+
+      if ($title_display == 'without_title') {
+        unset($tmp['textfield']['#title']);
+      }
+      else {
+        $tmp['textfield']['#title_display'] = $title_display;
+      }
+
+      $this->drupalSetContent(drupal_render($tmp));
+
+      // The CSS class must appear at the form
+      if ($expected) {
+        $this->assertRaw('form-label-none', t('form-label-none CSS class found'));
+      }
+      // The CSS class must not appear at the form
+      else {
+        $this->assertNoRaw('form-label-none', t('form-label-none CSS class not found'));
+      }
+    }
+  }
+}
