css--vertical Menu creation for list and navigation bar menus

Source: Internet
Author: User

The Navigation bar menu, which is shown in the image on the left. Below, we will expand how to make.

1, first, the production of a vertical Project menu, with <ul><li> tags to write the basic content, and then in the style sheet with margin and padding to remove the internal and external margins, with List-style attributes to remove the original bullets, insert their favorite bullets, the code is as follows:

<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />    <title>Lists and navigation bars</title><styletype= "Text/css">ul{padding:0;margin:0;List-style:None;    }Li{
Background:URL (symbolic address. png) no-repeat 0 50%;//This time must write background height:30px;Line-height:30px;Padding-left:30px; }</style></Head><Body><ul> <Li><a href = "#" >Project1</a></Li> <Li><a href = "#" >Project2</a></Li> <Li><a href = "#" >Project3</a></Li> <Li><a href = "#" >Project4</a></Li></ul></Body></HTML>

You can also set your favorite borders and background colors for your project at the same time:

li{        Background:url (%e9%a1%b9%e7%9b%ae%e7%ac%a6%e5%8f%b7.png) no-repeat 0 50%;//This time must write background        height: 30px;line-height:30px;        padding-left:30px;        Display:block;        width:70px;        Background-color: #CCC;        border:1px solid #666;    }

At this point, you will find that the middle border line is thicker, you can solve the problem by removing the bottom border, and then adding the last item or the first item:

li{     border-bottom:0;   } UL #last {        border-bottom:1px solid #666;        }

This time, the basic style of the vertical navigation bar has come out, of course, we also need:: hover,:focus,:selected state:

UL Li A:hover,ul li a:focus{            color: #000;            Background-color: #960;            }

This time, both the beautiful style and the flip effect of the vertical navigation menu is born ~ ~ ~

css--vertical Menu creation for list and navigation bar menus

Related Article

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.