?
Solved

Handling empty sub-menus with CSS

Posted on 2016-10-03
2
Medium Priority
?
59 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
[X]
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
2 Comments
 
LVL 58

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

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
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…
Suggested Courses

771 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