您的位置:首页 > 其它

display:block 的认识

2012-09-13 17:45 169 查看
white-space:nowrap; + display:block 下面一种情况要注意

<style type="text/css">
html {
overflow: hidden;
}
body {
background: #222;
}
#menu {
padding: 10px;
background: #000;
height: 300px;
width: 400px;
}
#menu a {
display:block;
text-decoration:none;
font-family: arial, helvetica, verdana, sans-serif;
white-space: nowrap;
}

</style>

<script type="text/javascript"><!--
var P,T;
var over = -1;

///////////////
var fontSize = 38;
var lensFX = 1;
var num = true;
var color = "#FFF";
var selected = "#F80";
///////////////

function zoom(s){
if(s!=over){
over = s;
for(var i=0;i<T;i++){
P[i].style.fontSize=Math.floor(fontSize / (Math.abs(i - s) +

lensFX) + 3)+"px";
P[i].style.color=(i==s)?selected:color;
}
}
}

onload = function(){
P = document.getElementById("menu").getElementsByTagName("a");
T = P.length;
for (var i=0;i<T;i++){
if(num){
x=i+".";
if(x.length<3)x="0"+x;
P[i].innerHTML = x+P[i].innerHTML;
}
P[i].style.width = "100%";
P[i].onmouseover=new Function("zoom("+i+");");
}
zoom(0);
}
//-->
</script>
</head>

<body>

<div id="menu">
<a href="#">scripting</a>
<a href="#">javascript</a>
<a href="#">web</a>
<a href="#">dhtml</a>
<a href="#">css</a>
<a href="#">ajax</a>
<a href="#">programming</a>
<a href="#">design</a>
<a href="#">webdesign</a>
<a href="#">html</a>
<a href="#">dom</a>
<a href="#">webdev</a>
<a href="#">reference</a>
<a href="#">tools</a>
<a href="#">tutorial</a>
<a href="#">xmlhttprequest</a>
<a href="#">menu</a>
<a href="#">xml</a>
<a href="#">library</a>
<a href="#">development</a>

</div>

</body>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: