posición css como fija pero dependía del padre

does anybody know a way of positioning an element to be always in the same position, but having different parents that are in another.

Ok to make is clearer here is an example. You have horizontal dropdown navigation, when u hover over one navi element, u see subnavi just under the element you hover over, how can I make it to appear on, for instance, top left corner of the screen, always. Next button will be next to the first one, for about 100px right, and now when u set pos absolute or relative, the subnavi wont be exacty in the same position as the first one, but 100px to the right. And also, I can't use special class or ids, only global classes.

preguntado el 27 de noviembre de 13 a las 07:11

Create a jsfiddle by going to jsfiddle.net then it will be easy to answer. -

2 Respuestas

Without your code its hard to answer your question, I however give it a try:

You can make it by applying position: absolute; left: 0px (change left to your wishes, and add a top: 0px if you want to adjust the stating height), to your submenu, check esta demo.

Note that the submenu only appears when you hover the parent. On blur, it disappears. When you want it to stay, you'll need some javascript (or jQuery).

respondido 27 nov., 13:08

position the parent DIV "relative" than you position the child div "absolute".

http://css-tricks.com/absolute-positioning-inside-relative-positioning/

respondido 27 nov., 13:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.