有没有办法根据第二个亲戚来定位绝对元素?
<ul> <!-- This has position:relative; -->
<li> <!-- This has position:relative; -->
<ul> <!-- position:absolute this relative to the parent ul -->
<li></li>
</ul>
</li>
</ul>
CSS
ul{
position:relative;
}
ul > li {
position:relative; /* I need this because of pseudo :after */
}
ul > li ul{
position:absolute;
left:0; /* This is what i want to do. Left based on parent ul not parent li... */
}
答案 0 :(得分:2)
那是不可能的。绝对元素只能基于第一个相对父元素来定位自己。