Pure CSS to make simple vertical navigation

Source: Internet
Author: User
Tags relative
Css The following is a reference fragment:
/* Common Styling * *
/* Set up the overall width of the menu Div, the font and the margins * *

. menu {
Font-family:arial, Sans-serif;
width:750px;
margin:0;
margin:50px 0;
}
/* Remove the bullets and set the margin and padding to zero for the unordered list * *
. menu UL {
padding:0;
margin:0;
List-style-type:none;
}
/* Floating list, so you can have items on one line, and their relative positioning allows the following list to appear in the correct position.
. menu ul Li {
Float:left;
position:relative;
}
/* Style The links to is 104px wide by 30px high with a and right border 1px solid.
Set the background color and the font size. */
. menu ul li A,. Menu ul Li a:visited {
Display:block;
Text-align:center;
Text-decoration:none;
width:104px;
height:30px;
Color: #000;
border:1px solid #fff;
border-width:1px 1px 0 0;
Background: #c9c9a7;
line-height:30px;
font-size:11px;
}
* Make the dropdown ul invisible * *
. menu UL Li ul
Display:none;
}

/* Specific to non IE browsers * *
/* Set the background and foreground color of the main menu Li on hover * *
. Menu ul Li:hover a {
Color: #fff;
Background: #b3ab79;
}
* Make the Sub menu UL visible and position it beneath the main Menu list item * *
. Menu UL Li:hover ul {
Display:block;
Position:absolute;
top:31px;
left:0;
width:105px;
}
/* Style The background and foreground color of the submenu links */
. menu UL Li:hover ul li a {
Display:block;
Background: #faeec7;
Color: #000;
}
/* Style The background and forground colors of the links on hover * *
. menu UL Li:hover ul li a:hover {
Background: #dfc184;
Color: #000;
}

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.