Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8795055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:20:06+00:00 2026-06-13T23:20:06+00:00

I have an unordered inline horizontal list menu, when my mobile media query kicks

  • 0

I have an unordered inline horizontal list menu, when my mobile media query kicks in I want the css to change so that it has a parent item called ‘menu’ that when clicked displays the menu child links in a vertical list.

What is the best way to achieve this?

Should I create both types of menu and use css to switch their visibility or is there a way I can make the first menu become the new second menu?

Any help would be really appreciated. I am sure switching between hidden css property on each would work but I wasn’t sure how semantic friendly this would be etc?

Cheers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:20:07+00:00Added an answer on June 13, 2026 at 11:20 pm

    Righto, it took a bit of work but I’ve created a working example of what you’re after here

    HTML

    <a href="#" id="nav-status">Open / Close</a>
    <ul id="navigation">
        <li><a href="#">Item 1</a></li>
        <li><a href="#">Item 2</a></li>
        <li><a href="#">Item 3</a></li>
        <li><a href="#">Item 4</a></li>
        <li>
            <a href="#">Item 5</a>
            <ul>
                <li><a href="#">Sub Item 1</a></li>
                <li><a href="#">Sub Item 2</a></li>
                <li><a href="#">Sub Item 3</a></li>
            </ul>
        </li>
        <li><a href="#">Item 6</a></li>
        <li><a href="#">Item 7</a></li>
    </ul>
    

    ​CSS

    /* FOR ANYTHING GREATER THAN MOBILE RESOLUTION */
    @media screen and (min-width: 480px) {
        #nav-status {
            display: none;    
        }
    
        ul {
            width: 100%;    
            min-height: 25px;
            color:#fff;
            background:#CCC;
            overflow: visible;
        }
    
        ul li {
            color:#000;
            border-right: 1px solid #333;
            width: 96px;
            height: 21px;
            padding:2px;
            display: block;
            float: left;
            position: relative;    
        }
    
        ul li:last-child {
            border-right: none;
        }
    
        ul li ul {
            display: none;
            width: 100px;
            color:#fff;
            background:#666;
            position: absolute; 
            top: 25px; 
            left: 0px;
            overflow: hidden;
        }
    
        ul li:hover ul {
            display: block;    
        }
    }
    
    /* FOR MOBILE RESOLUTIONS */
    @media screen and (max-width: 480px) {
        #nav-status {
            display: block;
            width: 100%;
            height: 21px;
            padding: 2px;
            background: #000;
            color: #FFF;   
        }
    
        ul {
            display: none;
            width: 100%;       
            color:#fff;
            background:#CCC;
            overflow: visible;
        }
    
        ul li {
            color:#000;
            border-bottom: 1px solid #333;
            width: 100%;
            min-height: 21px;
            padding:2px;
            display: block;        
            position: relative;    
        }
    
        ul li:last-child {
            border-bottom: none;
        }
    
        ul li ul {
            display: block;
            width: 100%;
            color:#fff;
            background:#666;        
            overflow: hidden;
            position: relative;
        }        
    }
    ​
    

    JAVASCRIPT

    $(function() {
        $('#nav-status').click(function(e) {
            e.preventDefault();
            $('#navigation').toggle();
        });​
    });
    

    In summary, any time the resolution drops under 480px wide, the mobile styling will kick in. This’ll basically stack the menu items vertically and allow you to collapse/expand the nav with the open/close link. Anything larger than 480px will use the default styling which will order the menu items horizontally.

    Hopefully it all makes sense 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a drop-line horizontal menu using an unordered list with the following
I have an unordered list of images that display inline and float next to
I have an unordered list whose list items are displaying inline. However, its layout
I have an unordered list that is a child in a smaller parent div
I have several unordered lists that I want to display like this: <ul> <li><img></li>
I've coded myself into a CSS corner. I have a list of images that
I have an unordered list of Points ( List<Point> ) and I want to
I have an unordered list set up for a hover/dropdown menu. I have the
I have a horizontal unordered list of 2 images. Intent is to make the
When I have an unordered list formatted as inline-blocks, the last list element in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.