Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Handling empty sub-menus with CSS

Posted on 2016-10-03
2
50 Views
Last Modified: 2016-10-03
I had this question after viewing The Menu is good, but needs a couple of Tweaks.

The DIV structure is generated via reading a JSON file and programmatically building the DIVs with whatever nesting the JSON file specifies.  On occasion,  the JSON file can only have a top level link and the sub menu is empty.  The generated structure works but displays an empty node.

Is there any way to hide empty sub-menus?  

I will attach a picture demonstrating the issue and the section of the DIV structure that produces it.

Empty sub menu item
Here is the associated html fragment which produces it

      <div class="item">
        <a href="http://www.w3schools.com/js/default.asp">99-JavaScript Tutorial</a>
        <div class="sub-menu">
          <div class="col_1 sub-menu-item">
          </div><!-- Close Col Div  -->
        </div>
      </div>   
      

Open in new window

0
Comment
Question by:Howard Bash
2 Comments
 
LVL 55

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 41826293
I would rather put logic in not to render it in the first place.
0
 
LVL 1

Author Comment

by:Howard Bash
ID: 41826318
Agreed.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question