Heim  >  Artikel  >  Web-Frontend  >  CSS如何让浮动导航栏元素居中显示_html/css_WEB-ITnose

CSS如何让浮动导航栏元素居中显示_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:31:011872Durchsuche

CSS如何让浮动导航栏元素居中显示:
制作导航栏是最为基础的布局技能之一,当然对于稍有经验的人员来说没有任何问题,不过对于初学者可能会有一定的困扰。普通的导航栏一般具有一下几个特点,整个导航栏居中,导航栏目具有,并且能够均匀分布,下面就是一个这样的简单代码实例。
代码如下:

<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css">*{  margin:0;  padding:0;  list-style:none;}body{text-align:center;}li{  float:left;  font-size:12px;}a{  float:left;  border:1px solid #000;  padding:5px 10px;  text-decoration:none;  color:#000;}ul{  display:inline-block;  *display:inline;  zoom:1;}</style></head><body><ul>  <li><a href="#nogo">首页</a></li>  <li><a href="#nogo">关于</a></li>  <li><a href="#nogo">产品</a></li>  <li><a href="#nogo">联系我们</a></li>  <li><a href="#nogo">留言</a></li></ul></body></html>

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=11570

更多内容可以参阅:http://www.softwhy.com/divcss/

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn