Production -imooc navigation menu

Production Chapter 1 vertical menu

Production of vertical menu 1-1

Q: usually htmlin what tag to build the navigation bar menu?
A: The general use " ul\li" to create "menu navigation bar."

<style>
*{margin:0; padding:0; font-size:14px;}
ul{list-style:none;width:100px;}/*消除前面的圆点*/
a{text-decoration:none; /*消除下划线*/display:block;height:30px; line-height:30px; width:100px;background-color:#ccc;margin-bottom:1px;text-indent:10px;}
a:hover{background-color:#f60;color:#fff}/*鼠标划过显示的内容*/
</style>
<body>
<ul>
<li><a href="#">首  页</a></li>
<li><a herf="#">新闻快讯</a></li>
<li><a herf="#">产品展示</a></li>
<li><a herf="#">联系我们</a></li>
</body>

Chapter 2 production level menu

<!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>导航菜单</title>
<style type="text/css">
*{margin:0; padding:0; font-size:14px;}
ul{ list-style:none;}
a{color:#333;text-decoration:none}
.nav li{ float:left;}//
.nav li a{ display:block; text-indent:20px; height:30px; line-height:30px; width:100px; background-color:#efefef; margin-bottom:1px;}
.nav li a:hover{ background-color:#F60; color:#fff}
</style>

</head>
<body>

<ul class="nav">
    <li><a href="#">首  页</a></li>
    <li><a href="#">新闻快讯</a></li>
    <li><a href="#">产品展示</a></li>
    <li><a href="#">售后服务</a></li>
    <li><a href="#">联系我们</a></li>
  </ul>

</body>
</html>

This article is reproduced in: Ape 2048 https://www.mk2048.com/blog/blog.php?id=hi0ikb02bbb

Guess you like

Origin www.cnblogs.com/homehtml/p/12653801.html