开发者

Why are my list items displayed above their parent <div>?

This is happening in both Safari and Firefox. My navigation bar looks like this:

<div>
  <ul>
    <li><a href=开发者_JAVA百科"#">Test</a></li>
  </ul>
</div>

The relevant CSS looks like:

li {
  float: left
}

a:hover {
  background-color: blue;
}

For some reason, the list items are floating above the <div> they're inside (#navBar). I can't figure out why this seemingly simple design is causing problems.

Why are my list items displayed above their parent <div>?

Thanks for the advice.


Add display: block to #navBar a.

Why are my list items displayed above their parent <div>?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜