CSS
  • gap in IE7

后端 未结 7 1055
别那么骄傲
别那么骄傲 2021-02-04 12:22

I have a CSS

  • nested menu that works perfectly in IE 8 and firefox but in IE7 it produces a small gap between the elements. this
7条回答
  •  梦如初夏
    2021-02-04 13:09

    If you're displaying the

  • elements inline (to create a horizontal menu) the line-breaks between the sibling
  • s are being converted into a single white-space. You can either comment-out the spaces, or put all the siblings on the same line:

    commenting-out:

    ...
  • element One
  • element Two
  • element Three
  • ...

    or:

    ...
  • element One
  • element Two
  • element Three
  • ...

    (in the latter example note the closing > of the

  • tags on the next line immediately preceding the next sibling)

    or you can use same-line siblings:

    ...
  • element One
  • element Two
  • element Three
  • ...

    You could also just use float: left on the li elements, which takes them out of the inline document flow. Possibly a negative left-margin to move the li left to 'cover' the preceding whitespace, though it would likely take trial and error to find a suitable measurement to cover the space without covering the preceding li element.

提交回复
热议问题