Jimmy1985

CSS/XHTML
随笔 - 2, 文章 - 4, 评论 - 7, 引用 - 0
数据加载中……

水平菜单居中二--Center Menu No Float

FF3.0/Opera9.6/IE6.0通过
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Center Menu No Float</title>
<style type="text/css">
{
    margin
:0;
    padding
:0;
}
body 
{
    font
:13px/150% Verdana, Arial, Helvetica, sans-serif;
}
.menu 
{
    display
:table;           /* ignored by IE */
    margin
:0 auto;
    list-style-type
:none;
    white-space
:nowrap;      /* keep text on one line */
    border
:1px solid #06a;   /* add a border to show size of menu */
 +display
:inline-block;
 +width
:1px;
+padding
:0 4px 0 3px;        /* fix IE bug */ 
}
.menu li 
{
    display
:table-cell;      /* ignored by IE */
 +display
:inline;            /* only for IE */
}
.menu a:link, .menu a:visited 
{
    display
:block;           /* for all browsers except IE */
    padding
:4px 16px;
    color
:#000;
    background
:#d4d4d4;
    border
:1px solid #fff;   /* add a 1px white border around each list item */
    text-decoration
:none;
 +display
:inline-block;        /* only for IE */
 +margin
:0 -4px 0 -3px;        /* fix IE bug that double the border width */
}
.menu a:hover 
{
    color
:#fff;
    background
:#08c;
}
</style>
</head>
<body>
<ul class="menu">
  
<li><href="#">首页</a></li>
  
<li><href="#nogo">我的文章</a></li>
  
<li><href="#nogo">相册</a></li>
  
<li><href="#nogo">关于我</a></li>
  
<li><href="#">我的友情链接</a></li>
</ul>
</body>
</html>



jimmy1985

posted on 2009-01-22 17:11 jimmy liang 阅读(356) 评论(0)  编辑  收藏 所属分类: CSS/XHTML


只有注册用户登录后才能发表评论。


网站导航: