修复CSS图像菜单
我正在尝试创建一个基于 css 的图像翻转导航栏。由于某种原因,我无法将图像放在正确的位置。我希望有人能提供帮助。
I am trying to create a css based image rollover navigation bar. For some reason, I can not get the images in the right place. I was hoping someone could help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先突出的事情之一是您正在尝试使用 postion:absolute,但您没有定义父容器的位置。为了使绝对定位发挥作用,父元素必须具有默认静态位置以外的位置。
您似乎还在很多地方使用了 display:block ,这些地方要么是多余的(LI 已经是块元素),要么是不需要的,因为您正在内联显示菜单项。使用 diplay:block 会在显示为块的元素后面插入换行符。
One of the first things that sticks out is that you are trying to use postion:absolute, but you don't have the position of the parent container defined. In order for absolute positioning to work, the parent element must have a position other than the default static position.
You also seem to be using display:block in a bunch of places where it is either redunant (LI are already block elements) or not needed since you are displaying the menu items inline. Using diplay:block inserts a line break after the element you are displaying as a block.
您没有将导航栏悬停区域放置在正确的位置,也许可以为其添加一些边距?
You did not position the navigation bar hover areas right, maybe add some margin to them?