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 8232231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:45:44+00:00 2026-06-07T17:45:44+00:00

I’m trying to make a simple navigation that will be served on mobile devices

  • 0

I’m trying to make a simple navigation that will be served on mobile devices where it is a grid like layout. There are two blocks on one row and there will be 3 rows. There is 5 links so the total number will be odd. Since the number is odd I am trying to make the current page class take up the whole width instead of having two links in a row.

Something like this very crude drawing:
enter image description here

Or if link 3 is the current page:

enter image description here

Currently I have a basic 5 link list. Here is the HTML:

            <nav id="primary_nav">
                <ul>
                    <li><a '. $this->getCurrentPage("contact") .' href="Contact">Contact</a></li>
                    <li><a '. $this->getCurrentPage("portfolio") .' href="Portfolio">Portfolio</a></li>
                    <li><a '. $this->getCurrentPage("resume") .' href="Resume">Resume</a></li>
                    <li><a '. $this->getCurrentPage("bio") .' href="Bio">Bio</a></li>
                    <li><a '. $this->getCurrentPage("index") .' href="Home">Home</a></li>
                </ul>

            </nav>

CSS:

#primary_nav ul {
    list-style: none;
    background: #1c1c1c;
    padding: 5px 0;
}

#primary_nav li a {
    display: block;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    letter-spacing: 0.1em;
    line-height: 2em;
    height: 3em;
    border-bottom: 1px solid #383838;
}

#primary_nav li:last-child a {
    border-bottom: none;
}

#primary_nav li a:hover,
#primary_nav li a:focus {
    color: #1c1c1c;
    background: #ccc;
}
  • 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-07T17:45:45+00:00Added an answer on June 7, 2026 at 5:45 pm

    Forget javascript, you can do it with css alone (no fancy css3).

    Here’s the Html…

    <nav id="primary_nav">
      <ul>
          <li><a href="Contact">Contact</a></li>
          <li class="selected"><a href="Portfolio">Portfolio</a></li>
          <li><a href="Resume">Resume</a></li>
          <li><a href="Bio">Bio</a></li>
          <li><a href="Home">Home</a></li>
      </ul>
    </nav>​
    

    …and here’s the CSS…

    #primary_nav {
        position: relative;
        text-align: center;
    }
    
    #primary_nav li {
        float: left;
        width: 50%;
    }
    
    #primary_nav li:nth-child(-n+3){
        margin-bottom: 40px; /*must match height set on "primary_nav a"*/
    }
    
    #primary_nav .selected {
        position: absolute;
        top: 40px; /*must match height set on "primary_nav a"*/
        width: 100%;
    }
    
    #primary_nav a {
        display: block;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        padding: 5px 10px 6px;
        border: 1px solid #aaa;
        height: 40px; 
    }
    

    ​
    All you need is to add class="selected" to the link referencing the currently selected page.

    See it in action at http://jsfiddle.net/joplomacedo/eYJG7/

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I have two tables with like below codes: Table: Accounts id | username |
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.