html+css二级导航栏有横线怎么消除

html-css017

html+css二级导航栏有横线怎么消除,第1张

、首先,打开html编辑器,新建一个html文件,例如:index.html。

2、在index.html中的<body>标签中,输入样式代码:style="overflow-x: scroll。

3、浏览器运行index.html页面,此时html会有横线滚动条,并且隐藏了纵向滚动条

导航栏下面横线可以通过css样式进行设置,属性为text-decorationg:underline

上述的方式设置的效果中位子颜色和下划线的颜色是一样的,如果想实现文字和下划线的颜色不一样,可以采用如下方法进行调整。

<a href="javascript:" style="color:#333"><span style="color:#f00">我是文字<span></a>

第3步中的文字嵌套在一个a链接中,实际下划线是使用的a链接的样式。

这样就可以到达两者颜色不一样的效果了。

你最好把你现有的代码发上来?因为这样好有针对性啊,我写完了你未必能用上啊。

因为我不知道你用的是文字型导航还是图片型导航还是结合型,不同的应用有不同的方法

——————————————下面的这个是专门针对导航采用了A链接的:

<style type="text/css">

.nav{

/*这里是你导航内文字的CSS*/

text-decoration:none

}

.nav:hover, .nav.select{

text-decoration:underline

}

</style>

<body>

<div>

<a class="nav" href="#">第一个</a>

<a class="nav" href="#">第二个</a>

<a class="nav" href="#">第三个</a>

<a class="nav" href="#">第四个</a>

<a class="nav" href="#">第五个</a>

</div>

</body>

____________下面的针对导航采用了非A链接的文字(因为考虑到IE6兼容的问题,才引入了JS):

<script type="">

window.onload = function(){

var myNav = document.getElementById("divNav").getElementsByTagName("span")

for(var i=0i<myNav.lengthi++){

myNav[i].onmouseover = function(){this.style.textDecoration = 'underline'}

myNav[i].onmouseout = function(){this.style.textDecoration = 'none'}

}

}

</script>

<style type="text/css">

#divNav span{

/*这里是你导航内文字的CSS*/

cursor:pointer

}

</style>

<body>

<div id="divNav">

<span>第一个</span>

<span>第二个</span>

<span>第三个</span>

<span>第四个</span>

<span>第五个</span>

</div>

</body>

_________________以上用法只针对文本型导航,如果想使用图片型,就麻烦多了,用法和灵活性也更多,所以得看到你的程序才能有针对性地回答。

.