css - Bring absolutely positioned element back into flow of flexbox parent element -
i'm working on layout navigation , nested subnav. bottom of subnav needs align bottom of parent element. save reading, easiest way describe point codepen made.
http://codepen.io/freshyill/pen/drxaj

now, explain i'm trying do:
- the navigation (the subnav, specifically), needs align bottom of parent.
- the parent element
display: flex,justify-content: flex-end, navigation align bottom. - the primary nav horizontal ,
position: relative. - the subnav horizontal ,
position: absolutebelow nav. - the search area's height unknown , doesn't need align top of parent
the problem since subnav position: absolute, primary nav, not subnav @ bottom, , subnav outside parent.
a few more things…
- i have little control on markup of nav lists.
- i solve setting height on subnav , giving primary nav bottom margin of same value. i'm trying avoid this.
- the real subnav roll on display other subnavs
- i'm willing consider other solutions moving subnav below nav.
imho there's no need position absolute, can use negative margins instead.
for example, if submenu 1 under third button, reset left-offset, margin-left:-200%
demo: http://jsfiddle.net/rupco3wh/
here's solution key:
ul.navlist > li > ul.subnav { width:400%; } ul.navlist > li:nth-child(2) > ul.subnav { margin-left:-100%; } ul.navlist > li:nth-child(3) > ul.subnav { margin-left:-200%; } ul.navlist > li:nth-child(4) > ul.subnav { margin-left:-300%; } hope fits needs
Comments
Post a Comment