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

  • Home
  • SEARCH
  • 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 8324441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:04:37+00:00 2026-06-09T00:04:37+00:00

I am trying to create a flyout menu with CSS and HTML. Essentially I

  • 0

I am trying to create a flyout menu with CSS and HTML. Essentially I would like to display a single button that reveals a list below it when hovered. The flyout list should be aligned with the right of the button. e.g.

           ////////////
           // BUTTON //
           ////////////
///////////////////////
//  FLYOUT OPTION    //
///////////////////////

I have followed a few examples and produced the following jsFiddle – http://jsfiddle.net/JT5gs/

However, I cannot figure out a way to position the flyout menu apart form using the margin values of the .filtersnav ul rule. E.g.

.filtersnav ul {
    margin:0px 0px 0px -165px;

This works when I know the width of the main button that reveals the flyout, but I need to add localisation to my site so the button could be any length as the text inside it could change.

To clarify my question, is it possible to position the flyout menu to the right of the button when the button has an undetermined width? The JsFiddle shows one flyout menu where the menu is aligned correctly to the right, but the second flyout (with a button containing a longer text value) does not align up correctly.

  • 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-09T00:04:38+00:00Added an answer on June 9, 2026 at 12:04 am

    Put position: relative on your li tag, and set right: 0 instead of margins on your ul tag :

    .filtersnav {
      background:#eeeeee;
      font-size:12px;
      font-family:verdana,sans-serif;
      font-weight:bold;
      z-index:1000;
      padding:0;
    }
    .filtersnav, .filtersnav ul {
      float:right;
      list-style:none;
      margin:0px;
      border: 1px solid #CCCCCC;
      min-width: 75px;
      padding:0;
      background-color: #EEEEEE;
      font-weight:bold;
      z-index:1000;
    }
    .filtersnav span {
      display:block;
      color:#000000;
      text-decoration:none;
      padding:3px 10px;
      cursor:pointer;
    }
    .filtersnav li {
      position: relative;
      float:left;
      padding:0;
      background:#eeeeee url('../images/Down.png') no-repeat 97% center;
    }
    .filtersnav ul {
      position:absolute;
      left:-999em;
      height:auto;
      width:280px;
      font-weight:normal;
      right: 0;
      line-height:1;
      border:0;
      border-top:1px solid #CCCCCC;
      padding:0;
    }
    .filtersnav li li {
      width:280px;
      border-bottom:1px solid #CCCCCC;
      border-left:1px solid #CCCCCC;
      border-right:1px solid #CCCCCC;
      font-weight:bold;
      font-family:verdana,sans-serif;
      background:#eeeeee;
    }
    .filtersnav li li span {
      padding:10px 10px;
      width:260px;
      font-size:12px;
      color:#000000;
    }
    .filtersnav li ul ul {
      margin:-33px 0 0 -281px;
      padding:0px;
      max-height:262px;
      overflow-x: hidden;
      overflow-y: auto;
    }
    
    .filtersnav li li:hover{
      background:#145197;
    }
    .filtersnav li ul li:hover span, .filtersnav li ul li li:hover span, .filtersnav li ul li li li:hover span, .filtersnav li ul li li li:hover span {
      color:#ffffff;
    }
    .filtersnav li:hover span, .filtersnav li.sfhover span {
      color:#ffffff;
    }
    .filtersnav li:hover li span, .filtersnav li li:hover li span, .filtersnav li li li:hover li span, .filtersnav li li li li:hover li span {
      color:#000000;
    }
    .filtersnav li:hover ul ul, .filtersnav li:hover ul ul ul, .filtersnav li:hover ul ul ul ul, .filtersnav li.sfhover ul ul, .filtersnav li.sfhover ul ul ul, .filtersnav li.sfhover ul ul ul ul {
      left:-999em;
    }
    .filtersnav li:hover ul, .filtersnav li li:hover ul, .filtersnav li li li:hover ul, .filtersnav li li li li:hover ul, .filtersnav li.sfhover ul, .filtersnav li li.sfhover ul, .filtersnav li li li.sfhover ul, .filtersnav li li li li.sfhover ul {
      left:auto;
      background:#eeeeee;
    }
    .filtersnav li:hover, .filtersnav li.sfhover {
      background:#145197 url('../images/DownSel.png') no-repeat 97% center;
    }
    .filtersnav li li:hover img {
      filter:Invert;
    }    
    .filtersnavSelected {
      background-color:#FCBF44
    }
    <ul class="filtersnav">
      <li>
        <span>Another Flyout Menu &nbsp; &nbsp;</span>
        <ul>
          <li>
            <span>Option</span>
            <ul>
              <li><span>Sub Option</span></li>
            </ul>
          </li>
        </ul>
      </li>
    </ul> 
    
    <ul class="filtersnav" style="margin-right:25px;">
      <li>
        <span>Flyout Menu &nbsp; &nbsp;</span>
        <ul>
          <li>
            <span>Option</span>
            <ul>
              <li><span>Sub Option</span></li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying create a layout. There are several inner layouts that should like
Im trying to create a Flyout Menu where the 2nd level is a big
I'm trying create a box in my Django app that displays text (and possibly
I'm trying create a ASMX webservice that can perform a HTTP GET request. I
I am trying create a small web application that allows a user to login
Trying to create a simple document that gets the parentNode then applies a background
Trying to create a pattern that matches an opening bracket and gets everything between
I'm trying create a gui using Tkinter that grabs a username and password and
I'm trying create this function such that if any key besides any of the
I'm trying create a query that will output a total number, as well as

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.