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.
Put
position: relativeon yourlitag, and setright: 0instead of margins on yourultag :