css/HTML中的水平菜单

css/HTML中的水平菜单,html,css,list,menu,Html,Css,List,Menu,大家好,我正在创建一个网站,但我对页脚菜单有点困扰-它只有在我使用float:left时才会变为水平(但在穿过某个点后,它会创建一条新线)。如果我使用的不是float:left,它将变为垂直。我的目标是在一条线上完成这一切。图像中的示例(我的目标是使页脚菜单与顶部菜单一样水平) 这是我使用的代码。基于菜单代码的页脚代码: #menuPan{width:736px; height:36px; position:relative} #menuPan ul.menu{position:absolut

大家好,我正在创建一个网站,但我对页脚菜单有点困扰-它只有在我使用float:left时才会变为水平(但在穿过某个点后,它会创建一条新线)。如果我使用的不是float:left,它将变为垂直。我的目标是在一条线上完成这一切。图像中的示例(我的目标是使页脚菜单与顶部菜单一样水平)

这是我使用的代码。基于菜单代码的页脚代码:

#menuPan{width:736px; height:36px; position:relative}

#menuPan ul.menu{position:absolute; top:0; left:0; width:736px; overflow: hidden; background-color:#3f3f3f;}
#menuPan ul.menu li{height:36px; margin-right:5px; float:left; font-size:large; }
#menuPan ul.menu li a{height:36px; display:block; display: inline-block; color: white; text-align: center; padding: 8px 10px; text-decoration: none;}
#menuPan ul.menu li a:hover{height:36px; background-color: #6d6d6d;}
和我的页脚代码:

#footer ul.footertest li{height:20px; float:left; font-size:large;}
#footer ul.footertest li a{height:20px; display:block; display: inline-block;  color:darkslategrey; text-align: center; padding: 8px 10px; text-decoration: none;}
#footer ul.footertest li a:hover{height:20px; background-color: #6d6d6d;}
试着申请

display: inline-block;

当你谈论某一点时,你是什么意思?您应该检查页脚菜单的宽度,因为如果它不包含很多元素,就不应该创建第二行。