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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:30:45+00:00 2026-06-14T16:30:45+00:00

Question : How do I get what comes after my NAV to not float?

  • 0

Question:
How do I get what comes after my NAV to not float?

Preface:
I am putting together a little reusable progress-tracker module to be plugged into some tools being built for internal use from within our firewall.
While cross-browser compatibility is nice, we only need to code against Chrome and FireFox. Those are the only browsers officially supported by our tech team.
Also, ANY and ALL suggestions for improvement are always welcome.

The Challenge: FLOATS!!
In order for the arrows to show correctly and behave intuitively, I had to right float the li‘s.
(by “had”, I mean “couldn’t think of a better way” 🙂

In order to prevent the whole nav from floating to the right, I had to left float that.
Now, whatever comes after the nav is right up there in-line with it.

Note:
You can also see and play with the code here on jsFiddle.

Code:
HTML:

<nav id="progress_tracker">
    <ul>
        <li><a href='#'>Grab a beer</a></li>
        <li><a href='#'>Work a little more</a></li>
        <li><a href='#' class="current">Take a Nap</a></li>
        <li><a href='#' class="complete">Work like a dog</a></li>
        <li><a href='#' class="complete">Grab a coffee</a></li>
    </ul>
</nav>

CSS:

nav {
    float: left;
}
nav#progress_tracker {
    padding: 0.25em;
    background-color: #1a3340;
    border-radius: 1.75em;
}
nav ul li:last-child{                       /* Remember. We are floating right, so last is furthest left */
    margin-left: -1.7em;
}
nav ul{
    list-style-type: none; 
}
nav ul li{
    display: inline-block;
    float: right;
    position: relative;
    padding: 0;
    margin: 0;
}
nav ul li a{
    display: inline-block;
    vertical-align: middle;
    color: #777;
    background-color: DDD;
    padding-top: 0.75em;                    /* top/btm padding need to be half of line-height */
    padding-bottom: 0.75em;                 /* top/btm padding need to be half of line-height */
    padding-left: 2em;                      /* left padding */
    padding-right: 1em;                     /* right padding is (left-padding - depth-of-arrow (see below) */
    line-height: 1.5em;                     /* line-height needs to be double top/btm padding */
}
nav ul li a:after{
    width: 0;
    height: 0;
    position: absolute;
    top: 0;
    right: -1em;                            /* depth of offset (equal to depth of arrow) */
    border-left: 1em solid #d9d9d9;         /* depth of arrow (equal to depth of offset) */
    border-top: 1.5em inset transparent;    /* border thickness needs to match line-height */
    border-bottom: 1.5em inset transparent; /* border thickness needs to match line-height */
    content: "";                            /* required to make all of this work */
}
nav ul li a:visited{
    color: #888888;
}

nav ul li a.current{
    font-weight: bold;
    color: #777;
    background-color: #FFBB00;
}
nav ul li a.current:after{
    border-left: 1em solid #FFBF00;         /* depth of arrow (equal to depth of offset) */
}

nav ul li a.complete{
    color: #666;
    background-color: #FFFFEE;
}
nav ul li a.complete:after{
    border-left: 1em solid #FFFFEF;         /* depth of arrow (equal to depth of offset) */
}

nav ul li:last-child a{                    /* Remember. We are floating right, so last is furthest left */
    border-top-left-radius: 1.45em;
    border-bottom-left-radius: 1.45em;
}
nav ul li:first-child a{                    /* Remember. We are floating right, so first is furthest rt */
    border-top-right-radius: 1.45em;
    border-bottom-right-radius: 1.45em;
}
nav ul li:first-child a:after{
    border: none;
}

Thanks-a-bunch.

  • 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-14T16:30:47+00:00Added an answer on June 14, 2026 at 4:30 pm

    I know you said you wanted to keep the markup the same, but you had an issue with using display:inline-block; and having space between the li elements. Here’s a working version without the float mess (example). It has :before and :after, each acting as half of the preceding arrow. I’ve added a :hover style so you can test the hovering and see how to style it yourself.

    Note: This does not look as pretty when wrapped.

    HTML

    <nav id="progress_tracker">
        <ul>
            <li><a href='#' class="complete">Grab a coffee</a></li><!--
            --><li><a href='#'>Work like a dog</a></li><!--
            --><li><a href='#' class="complete">Take a Nap</a></li><!--
            --><li><a href='#' class="current">Work a little more</a></li><!--
            --><li><a href='#'>Grab a beer</a></li>
        </ul>
    </nav>
    <p>Some random text</p>
    

    New CSS

    a:hover,
    a:hover:before,
    a:hover:after {
        background:lime !important;
    }
    nav#progress_tracker {
        display:inline-block;
        padding: 0.25em;
        background-color: #1a3340;
        border-radius: 1.75em;
        overflow:hidden;
    }
    nav ul{
        list-style-type: none;
    }
    nav ul li{
        display: inline-block;
        position: relative;
        padding: 0;
        margin: 0;
    }
    nav ul li a{
        display: inline-block;
        vertical-align: middle;
        color: #777;
        background: #1A3340;
        padding-top: 0.75em;                    /* top/btm padding need to be half of line-height */
        padding-bottom: 0.75em;                 /* top/btm padding need to be half of line-height */
        padding-left: 1em;                      /* left padding */
        padding-right: 1.5em;                   /* right padding is (left-padding + 1/2 depth-of-arrow (see below) */
        line-height: 1.5em;                     /* line-height needs to be double top/btm padding */
    }
    nav ul li a:before,
    nav ul li a:after {
        width: 1em;
        height: 1.5em;
        position: absolute;
        left: 0;
        content: "";                            /* required to make all of this work */
        background: #1A3340;
    }
    nav ul li a:before{
        top: 0;
        -webkit-transform: skewX(33deg) translate(-50%);
        -moz-transform: skewX(33deg) translate(-50%);
        transform: skewX(33deg) translate(-50%);
    }
    nav ul li a:after{
        bottom: 0;
        -webkit-transform: skewX(-33deg) translate(-50%);
        -moz-transform: skewX(-33deg) translate(-50%);
        transform: skewX(-33deg) translate(-50%);
    }
    nav ul li a:visited{
        color: #888888;
    }
    
    /* .current styles */
    nav ul li a.current{
        font-weight: bold;
        color: #777;
        background-color: #FFBB00;
    }
    nav ul li a.current:before,
    nav ul li a.current:after{
        background: #FFBF00;
    }
    
    /* .complete styles */
    nav ul li a.complete{
        color: #666;
        background-color: #FFFFEE;
    }
    nav ul li a.complete:before,
    nav ul li a.complete:after{
        background: #FFFFEF;
    }
    
    /* First/last fixes */
    nav ul li:first-child a {
        border-top-left-radius: 1.45em;
        border-bottom-left-radius: 1.45em;
    }
    nav ul li:last-child a {
        border-top-right-radius: 1.45em;
        border-bottom-right-radius: 1.45em;
    }
    nav ul li:first-child a:before,
    nav ul li:first-child a:after{
        background: none !important;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question comes after solving my last question , I'd like to get some
After running into this question today: Grails query not using GORM I wonder if
Apologies for asking too basic question but I couldn't get it cleared after reading
I was looking for an anwer to question Get next N elements from enumerable
HTML Javascript question to get the selected value of a input-select I can use
From my question at Get Foreign Key Value , I managed to get the
I have a route defined like this: GET /question/:q_id controllers.Questions.viewQuestion(q_id: Long) Then in my
I'm using Alberto Santini's solution to this question to get a spiral grid reference
Question: I can get the SQL Server database language by querying: SELECT @@language And
QUESTION: how to get at the star above the numbers My FIDDLE currently does

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.