?
Solved

Handling empty sub-menus with CSS

Posted on 2016-10-03
2
Medium Priority
?
71 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 60

Accepted Solution

by:
Julian Hansen earned 2000 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

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article discusses how to implement server side field validation and display customized error messages to the client.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

809 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