Using '#type"=>'container' to create a div wrapper around nested elements? From my reading a render array can define a wrapper div by using the '#type'=&gt;'container'. I am inserting a render array in the page_alter hook function in the page_bottom region. It appears that the container type does not work in this case. The code below does not wrap the two #markupelements with the div wrapper but instead outputs the div then the content at the same level.

$page['page_bottom']["notices"] = array(
  '#type' =&gt; 'container',
  '#attributes' =&gt; array(
    'id' =&gt; array('notices'),
  ),
);

$page['page_bottom']["notices"]['notices-placeholder'] = array(
  '#suffix' =&gt; "&lt;div id='notices-placeholder'&gt;",
  '#prefix' =&gt; '&lt;/div&gt;',
);

$page['page_bottom']["notices"]['notices-tab'] = array(
  '#markup' =&gt; '&lt;div class="notices-notification-tab"&gt;NOTICES &amp;nbsp;&lt;span class="notices-count"&gt;10&lt;/span&gt;&lt;/div&gt;',
);


What I want is the following.

&lt;div id="notices"&gt;
    &lt;div id="notices-placeholder"&gt;&lt;/div&gt;
    &lt;div  class="notices-notification-tab"&gt;NOTICES....&lt;/div&gt;
&lt;/div&gt;


What I get is the following.

&lt;div id="notices"&gt;&lt;/div&gt;
&lt;div id="notices-placeholder"&gt;&lt;/div&gt;
&lt;div  class="notices-notification-tab"&gt;NOTICES....&lt;/div&gt;


--- Added
I did try #children earlier in the day and it didn't work as well. Before I left for the day I also tried with

$page['page_bottom']["notices"]['notices-placeholder'] = array(
    '#suffix' =&gt; "&lt;div id='notices-placeholder'&gt;",
    '#markup'=&gt;"Empty String", // added to see what it would do
    '#prefix' =&gt; '&lt;/div&gt;',
);


This resulted in a completely out of sync html with the #markup tag being outside the #prefix/#suffix. I don't have the results on me now to post but if you try it you will see the results for your self.
I was able to obtain what you wanted using the following code.

  $page['page_bottom']["notices"] = array(
    '#type' =&gt; 'container',
    '#attributes' =&gt; array(
      'id' =&gt; array('notices'),
    ),
  );

  $page['page_bottom']["notices"]['notices-placeholder'] = array(
    '#type' =&gt; 'container',
    '#attributes' =&gt; array(
      'id' =&gt; array('notices-placeholder'),
    ),
  );

  $page['page_bottom']["notices"]['notices-tab'] = array(
    '#markup' =&gt; '&lt;div class="notices-notification-tab"&gt;NOTICES &amp;nbsp;&lt;span class="notices-count"&gt;10&lt;/span&gt;&lt;/div&gt;',
  );


The output I obtain using that code as implementation of hook_page_alter() is the following.

&lt;div id="notices"&gt;&lt;div id="notices-placeholder"&gt;&lt;/div&gt;&lt;div class="notices-notification-tab"&gt;NOTICES &amp;nbsp;&lt;span class="notices-count"&gt;10&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;


I tried using your code, and setting $page['page_bottom']["notices"]['#tree'] to TRUE, or setting $page['page_bottom']["notices"]['notices-placeholder']['#type'] to 'markup', but I always obtained the same result as you.

The only explanation I have is that, using your code, theme_container() (the function defined as theme wrapper for the "container" element) doesn't get any value for $element['#children']. That would explain why the container HTML output doesn't contain any children element, as the code executed by theme_container() is the following one.

  $element = $variables['element'];

  // Special handling for form elements.
  if (isset($element['#array_parents'])) {
    // Assign an html ID.
    if (!isset($element['#attributes']['id'])) {
      $element['#attributes']['id'] = $element['#id'];
    }
    // Add the 'form-wrapper' class.
    $element['#attributes']['class'][] = 'form-wrapper';
  }

  return '&lt;div' . drupal_attributes($element['#attributes']) . '&gt;' . $element['#children'] . '&lt;/div&gt;';


References


system_element_info()
drupal_render_page()