Solved

Handling empty sub-menus with CSS

Posted on 2016-10-03
2
29 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:hbash
2 Comments
 
LVL 51

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:hbash
ID: 41826318
Agreed.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now