html下拉框里怎么打出间距,CSS下拉菜单间距

我已经成功创建此导航菜单,但菜单项的间距已关闭。同样在次要名单上,由于其中一项,我不得不让它们变宽。有没有办法让宽度根据最长项目的长度而变化。CSS下拉菜单间距

Menu

body {

font-family: "Gill Sans", Calibri, "Trebuchet MS", sans-serif;

}

#nav, #nav ul { /* all lists */

padding: 0;

margin: 0;

list-style: none;

line-height: 1;

}

#nav a {

display: block;

width: 10em;

}

#nav li { /* all list items */

/* The sum of the next two lines creates the nav bar height*/

padding-top:12px;

height: 28px;

float: left;

background: #f15a22;

width: 7em; /* width needed or else Opera goes nuts */

}

#nav li ul { /* second-level lists */

position: absolute;

background: #f15a22;

width: 10em; /* controls width of background colour of second-level list - currently set to width of longest entry */

left: -999em; /* using left instead of display to hide menus because display: none isn't read by screen readers */

}

#nav li:hover ul, #nav li.sfhover ul { /* lists nested under hovered list items */

left: auto;

top: 45px; /* drops the second list below the nav bar so it doesn't cut off the bottom of any text from the main nav*/

}

/*--- from Storm3y's code ---*/

#nav li a {

color: #f9f7ee;

background-image:url(images/bullet2.gif);

background-position:0% 50%;

background-repeat:no-repeat;

padding-left: 16px;

text-decoration: none;

}

#nav li a:hover {

background-image:url(images/bulletsolid2.gif);

background-position:0% 50%;

background-repeat:no-repeat;

padding-left: 16px;

color: #f9f7ee;

}

2011-09-16

Ged

+0

当你说的间距为 “关”,是什么*应该*就像?菜单的总宽度应该是多少? –

+0

@thirtydot我认为海报是指这种现象:http://jsfiddle.net/uNNKd/1/(悬停在表演) –

+0

@约瑟夫:我的评论是关于他的第一句话,这似乎是在谈论不平衡文本之间的间距(忘记这部分的下拉菜单)。 –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值