title: Display: table-cell absolute positioning query
body: <p>I am building a drop-down menu for wordpress, and i've come across an interesting dilemna. Initialy i had a drop down when you hovered "shop" that would display all categories, and from their highlighting categories would bring up 5 random products in a div underneath that would span the whole width of the menu bar. <strong>This worked fine</strong></p>
  
  <p>However, the client at the time decided he needed <em>much more</em> categories than what were there, and aptly i had to break them down into subcategories. </p>
  
  <p>The menu currently works like this: </p>
  
  <p>Hover shop -> show main categories
  Hover categories -> show sub-categories. </p>
  
  <p>This part works absolutely fine; however the list to show the subcategories is laid out using css table settings in order to keep the sub-categories list spread evenly across the size of the menu. You can see an example of what i mean <a href="http://aladdinsmarket.co.uk/" rel="nofollow">here</a>.</p>
  
  <p>Previously, i didn't use the css table settings, as the menu fit just fine. The drop down div that contained the categories products worked just fine. Now that they are within the css table markup though, even though they are not defined as being so, seem to be "pretending" to be table-cells. Every drop down of the products is being placed to the right of each subcategory as a blank space. But because they are set to spread evenly, it makes it look very odd. </p>
  
  <p>So i have two questions: Firstly; despite displaying absolutely, the drop down products section is -not- going where i need it to go. Is there a way to break these out of the table layout?</p>
  
  <p>Secondly, if not, what other options do i have to make these categories display evenly across the parent div no matter how many subcategories i have? An option i considered was working out the width percentage needed using javascript and then applying that straight to the li's, however i'm not sure how viable that is. </p>
  
  <pre><code>$args = array(
  
       'taxonomy'     =&gt; $taxonomy,
       'orderby'      =&gt; $orderby,
       'show_count'   =&gt; $show_count,
       'pad_counts'   =&gt; $pad_counts,
       'hierarchical' =&gt; $hierarchical,
       'title_li'     =&gt; $title,
       'hide_empty'   =&gt; $empty
  );
  $all_categories = get_categories( $args );
  $categorycounter == 0;
  foreach ($all_categories as $cat) {
  if($cat-&gt;category_parent == 0) {
      $categorycounter = $categorycounter + 1;
      $categorypadding = "";
      $category_id = $cat-&gt;term_id;       
      echo $categorypadding . '&lt;li class="category-' . $categorycounter.  '"&gt;&lt;a class="main-nav-link" href="'. get_term_link($cat-&gt;slug, 'product_cat') .'"&gt;'. $cat-&gt;name .'&lt;/a&gt;&lt;div class="drop-down-'. $cat-&gt;name .'"&gt;&lt;section class="drop-down-section"&gt;&lt;section class="sub-list"&gt;';
  // set up subcategories to display below main categories
  
                $IDbyNAME = get_term_by('name', $cat-&gt;name, 'product_cat');
  
                $product_cat_ID = $IDbyNAME-&gt;term_id;
                      $args4 = array(
                     'hierarchical' =&gt; 1,
                     'show_option_none' =&gt; '',
                     'hide_empty' =&gt; 0,
                     'parent' =&gt; $product_cat_ID,
                     'taxonomy' =&gt; 'product_cat',     
                      'posts_per_page' =&gt; -1
                );            
  
              $subcategoryloop = get_categories( $args4 );        
              $subcount = 0;
              foreach ($subcategoryloop as $sc){
              if($subcategoryloop){
                  $subcount = $subcount + 1;
              $link = get_term_link( $sc-&gt;slug, $sc-&gt;taxonomy);
              echo '&lt;a class="subme" href="' . $link . '"&gt;'. $sc-&gt;name .'&lt;/a&gt;&lt;section class="drop-down-products"&gt;';
  
  
                                  //set up subcategories to display products   
  
                                          $args2 = array(
                                          'posts_per_page' =&gt; -1,
                                          'product_cat' =&gt; $sc-&gt;slug,
                                          'post_type'=&gt;'product',
                                           'orderby' =&gt; 'rand'
                                    );    
  
                                  $productcount = 0;
                                  $loop = new WP_Query( $args2 );
  
                                  while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post();
  
                                              $productcount = $productcount + 1;
                                              if($productcount &lt; 6){
                                              echo "&lt;section class='thumbcontainer'&gt;&lt;p&gt;&lt;a href='";
                                              the_permalink();
                                              echo "'&gt;" ;
                                              the_title();
                                              $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post-&gt;ID) );
                                                  echo "&lt;/a&gt;&lt;/p&gt;&lt;img src='" . $feat_image . "'/&gt;&lt;br/&gt;&lt;p class='dropdown-price'&gt;";
                                                  $price = get_post_meta( get_the_ID(), '_regular_price', true);
                                                  echo "&amp;pound;" .$price;
                                                  echo "&lt;/p&gt;&lt;/section&gt;";
  
  
  
                                              }
                                  endwhile;
  
              echo "&lt;section&gt;&lt;a class='view-more' href='". get_term_link($cat-&gt;slug, 'product_cat') ."'&gt;View More Products&lt;/a&gt;&lt;/section&gt;&lt;/section&gt;";
  
  
              }
              }
  echo "&lt;/section&gt;&lt;/section&gt;&lt;/div&gt;&lt;/li&gt;";
  
   }
   }
  </code></pre>
  
  <p>As a side note, i know my code is messy. Sorry! </p>