简体   繁体   English

Fluid div中的CSS导航问题

[英]CSS navigation issue in fluid div

I am trying to create a navigation with an image above each list item instead of an individual image per item. 我正在尝试创建一个导航,其中每个列表项上方都有一个图像,而不是每个项目都有一个单独的图像。 It looks fine when I am full screen but when I minimize the screen expecting the list items to stack nicely they stack over one another. 全屏显示时看起来不错,但当我最小化屏幕时,期望列表项可以很好地堆叠,所以它们会彼此堆叠。 Below is a list of my code: 以下是我的代码列表:

#nav ul, #nav li {
list-style: none;
font-size: 1.2em;
text-transform:uppercase;
}

#nav ul li {
display: inline;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
background: url(images/navico.jpg) no-repeat center;
padding-top: 50px;
padding-right: 4px;
padding-bottom: 0px;
padding-left: 6px;
}

This is a link to the page http://ecoairofswfl.com/Bush2/ 这是到页面http://ecoairofswfl.com/Bush2/的链接

Try this, 尝试这个,

#nav ul li {
  background: url("images/navico.jpg") no-repeat scroll center center transparent;
  display: block;
  float: left;
  list-style: none outside none;
  padding: 50px 4px 0 6px;
}

I changed them to block elements and floated them to the left; 我将它们更改为块元素,然后将它们浮动到左侧。 inline doesn't work as intended with stacking. 内联不能正常使用堆叠。

Solution is
#nav ul li {
    display: inline-block;
    list-style-image: none;
    list-style-position: outside;
    list-style-type: none;
    background: url(images/navico.jpg) no-repeat center;
    padding-top: 50px;
    padding-right: 4px;
    padding-bottom: 0px;
    padding-left: 6px;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM