开发者

Problem with CSS postion: relative with position: absolute children

开发者 https://www.devze.com 2022-12-20 17:38 出处:网络
Usually this sort of thing I can do, but today it is bugging me. See this page at JSbin. Essentially what I\'m doing is

Usually this sort of thing I can do, but today it is bugging me.

See this page at JSbin.

Essentially what I'm doing is

  • have a list of unordered items
  • they all have a link
  • jQue开发者_JAVA百科ry loops through and makes an extra link inside the list item, which is expanded to the whole list item using CSS
  • this gives users a larger place to click

For some reason, the child link seems to be coming out of the parent, despite the parent having position: relative.

What have I done wrong? Many thanks.


Your problem is that the parent <li> is an inline-box.

To fix it, replace display: inline-box with float: left.


I removed the display: -moz-inline-box; and it worked perfectly!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号