Web front-end development Combat 4: navigation menu (i)

Source: Internet
Author: User

In the previous blog post we mentioned the horizontal level menu, here we take a look at the navigation menu. There are many kinds of navigation menus, but the principle of production is Datong

Small different, it is easier to see than the two drop-down menu. Look at some of the navigation menus on the website:

Vertical navigation Menu:


Horizontal navigation Menu:


A vertical menu

Production principle: (1) build menus with unordered lists; (2) settings for <a> Tags: ul Li A{display:block;}. The key to the definition is to set the <a> tag to

Block element.

Code:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

Effect Show:

State of initialization or mouse leave:


Mouse on the state:


Two-level menu

Production principle: On the basis of the vertical menu, the LI element is left floating set. because the LI element floats out of the original document flow, it loses width and height, because

It is important to use the Display:block property on the a element to make it a block-level element, and then to set the width and height.

Just change the CSS style code:

/*CSS Global Settings */*{   margin:0;   padding:0;   font-size:16px;   Font-family: "Microsoft Jas Black";}. nav{   height:40px;   margin-top:50px;   margin-left:10px;}. Nav ul{   List-style:none;} /* Set the key */.nav li{   float:left;}. Nav Li a{    background-color: #EEEEEE;    Text-decoration:none;    Color: #000000;    Display:block;    width:90px;    height:40px;    line-height:40px;    Text-align:center;    margin-right:1px;}. Nav Li a:hover{    background-color: #FF6600;    Color: #FFFFFF;}

Effect Show:


Three-fillet menu

Production principle: On the basis of the horizontal menu we make CSS fillet property settings, but ie6,7,8 browser does not support this property, make a certain

To consider browser compatibility, here we use the Fillet property. The way to resolve incompatibilities is that we can crop the rounded background image as each Li element

Background.

The complete code:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

Effect Show:

State of initialization or mouse leave:


The state of the mouse move up:






Web front-end development Combat 4: navigation menu (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.