search
HomeWeb Front-endCSS Tutorialcss set web navigation bar

css set web navigation bar

Mar 27, 2017 pm 05:55 PM
css

This article mainly introduces the relevant information of css to set the web navigation bar in detail. Friends who need it can refer to it

html页面:
<!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" dir="ltr" lang="zh-CN"> 
<head profile="http://gmpg.org/xfn/11"> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <title>FreeBSD</title>       
    <link rel="stylesheet" type="text/css" media="all" href="./css/style.css"> 
    <link rel="stylesheet" id="superfish-css" href="./css/superfish.css" type="text/css" media="all">    
</head> 
<body> 
    <div class="menu-header"> 
        <ul id="menu-%e5%af%bc%e8%88%aa" class="nav sf-js-enabled"> 
            <div id="home_btn"> 
                <a href="#">首页</a> 
            </div> 
            <li> 
                <a href="#">风雨</a> 
            </li>        
            <li id="menu-item-92" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-92"> 
                <a href="#">飘</a> 
            </li> 
        </ul> 
    </div>  
</body> 
</html>
css文件: 
/*** ESSENTIAL STYLES ***/ 
.nav, .nav * { 
    margin:         0; 
    padding:        0; 
    list-style:     none; 
} 
.nav { 
    line-height:    1.0; 
} 
.nav ul { 
    position:       absolute; 
    top:            -999em; 
    width:          13em; /* left offset of submenus need to match (see below) */ 
} 
.nav ul li { 
    width:          100%; 
} 
.nav li:hover { 
    visibility:     inherit; /* fixes IE7 &#39;sticky bug&#39; */ 
} 
.nav li { 
    float:          left; 
    position:       relative; 
} 
.nav a { 
    display:        block; 
    position:       relative; 
} 
.nav li:hover ul, 
.nav li.sfHover ul { 
    left:           0; 
    top:            36px; /* match top ul list item height */ 
    z-index:        99; 
} 
ul.nav li:hover li ul, 
ul.nav li.sfHover li ul { 
    top:            -999em; 
} 
ul.nav li li:hover ul, 
ul.nav li li.sfHover ul { 
    left:           13em; /* match ul width */ 
    top:            0; 
} 
ul.nav li li:hover li ul, 
ul.nav li li.sfHover li ul { 
    top:            -999em; 
} 
ul.nav li li li:hover ul, 
ul.nav li li li.sfHover ul { 
    left:           13em; /* match ul width */ 
    top:            0px; 
} 
 
/*** DEMO SKIN ***/ 
.nav { 
    float:  left; 
    font-family: Verdana, Arial, Helvetica, sans-serif; 
    font-size: 14px; 
} 
.nav a { 
    padding: 1em 1.1em 1em 1.1em; 
    text-decoration:none; 
    background: url("22.png") no-repeat -1px 0px; 
} 
 
 
.nav a, .nav a:visited  { /* visited pseudo selector so IE6 applies text colour*/ 
    color: #333; 
    font-weight: 800; 
} 
 
.nav li { 
    /*background: url("../images/menu_divider.png") no-repeat -1px 0px;*/ 
    /*background: url("11.png") no-repeat -1px 0px;*/ 
} 
 
.nav li:hover a { 
    color: #eee; 
} 
 
.nav li li a { 
    background: #333; 
     
} 
.nav li li a:hover { 
    text-decoration: underline; 
} 
.nav li ul { 
    background: #000; 
} 
 
.nav li:hover, .nav li.sfHover, 
.nav a:focus, .nav a:hover, .nav a:active { 
    outline: 0; 
    color: #fff; 
    background: #0088ff;/*鼠标划过或者激活*/ 
} 
 
.nav li ul li:hover, .nav li ul li.sfHover, 
.nav li ul li a:focus, .nav li ul li a:hover, .nav li ul li a:active { 
    outline: 0; 
    color: #fff; 
} 
 
.nav li.current_page_item, 
.nav li.current-cat { 
    background: #333; 
} 
 
.nav li.current_page_item a, 
.nav li.current-cat a { 
    color: #fff; 
}

The above is the detailed content of css set web navigation bar. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
A Little Reminder That Pseudo Elements are Children, Kinda.A Little Reminder That Pseudo Elements are Children, Kinda.Apr 19, 2025 am 11:39 AM

Here's a container with some child elements:

Menus with 'Dynamic Hit Areas'Menus with 'Dynamic Hit Areas'Apr 19, 2025 am 11:37 AM

Flyout menus! The second you need to implement a menu that uses a hover event to display more menu items, you're in tricky territory. For one, they should

Improving Video Accessibility with WebVTTImproving Video Accessibility with WebVTTApr 19, 2025 am 11:27 AM

"The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect."- Tim Berners-Lee

Weekly Platform News: CSS ::marker pseudo-element, pre-rendering web components, adding Webmention to your siteWeekly Platform News: CSS ::marker pseudo-element, pre-rendering web components, adding Webmention to your siteApr 19, 2025 am 11:25 AM

In this week's roundup: datepickers are giving keyboard users headaches, a new web component compiler that helps fight FOUC, we finally get our hands on styling list item markers, and four steps to getting webmentions on your site.

Making width and flexible items play nice togetherMaking width and flexible items play nice togetherApr 19, 2025 am 11:23 AM

The short answer: flex-shrink and flex-basis are probably what you’re lookin’ for.

Position Sticky and Table HeadersPosition Sticky and Table HeadersApr 19, 2025 am 11:21 AM

You can't position: sticky; a

Weekly Platform News: HTML Inspection in Search Console, Global Scope of Scripts, Babel env Adds defaults QueryWeekly Platform News: HTML Inspection in Search Console, Global Scope of Scripts, Babel env Adds defaults QueryApr 19, 2025 am 11:18 AM

In this week's look around the world of web platform news, Google Search Console makes it easier to view crawled markup, we learn that custom properties

IndieWeb and WebmentionsIndieWeb and WebmentionsApr 19, 2025 am 11:16 AM

The IndieWeb is a thing! They've got a conference coming up and everything. The New Yorker is even writing about it:

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.