<body>
<ul>
<li ><a href="#" class="one">首 页</a></li>
<li><a href="#">新闻快讯</a></li>
<li><a href="#">产品展示</a></li>
<li><a href="#">售后服务</a></li>
<li><a href="#">联系我们</a></li>
</ul>
</body>
<ul>
<li ><a href="#" class="one">首 页</a></li>
<li><a href="#">新闻快讯</a></li>
<li><a href="#">产品展示</a></li>
<li><a href="#">售后服务</a></li>
<li><a href="#">联系我们</a></li>
</ul>
</body>
增加10px左内边距之所以撑开父容器是因为li也设置了100px的width;如果不设置是auto,不会撑开的。单行文本一般用height=line-height来垂直居中(vertical-align很难控制),而一般行内元素水平居中不用text-indent吧,text-align:center ok,“首页”空格有效设置输入法为全角就好(快捷键Shift+Space)
2016-04-20
.subNav{ position:absolute;z-index: -1; top:-90px;}
var subnav = this.getElementsByClassName('subNav')[0];
clearInterval(subnav.time);
subnav.time = setInterval(function(){if(subnav.offsetTop<30){subnav.style.top = subnav.offsetTop + 10 +'px';}else{clearInterval(subnav.time);}},30);
var subnav = this.getElementsByClassName('subNav')[0];
clearInterval(subnav.time);
subnav.time = setInterval(function(){if(subnav.offsetTop<30){subnav.style.top = subnav.offsetTop + 10 +'px';}else{clearInterval(subnav.time);}},30);