search
HomeWeb Front-endCSS TutorialDIV and CSS realize the effect of imitating the navigation bar of Jingdong Mall

This article mainly introduces p CSS to realize the imitation Jingdong Mall navigation bar effect, involving page p css layout and related techniques of dynamic switching combined with onmouseout mouse events. It has certain reference value. Friends in need can refer to it

The example in this article describes how p CSS realizes the effect of imitating the navigation bar of Jingdong Mall. Share it with everyone for your reference. The details are as follows:

Here is a demonstration of the p CSS function code that imitates the navigation bar of Jingdong Mall. When the mouse slides over the navigation bar option, the corresponding submenu list will pop up. The interface is simple and elegant.

The screenshot of the running effect is as follows:

The specific code is as follows:

<!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=utf8" />
<title>京东商城导航条</title>
<style type="text/css">
.my_left_category{
    width:150px;
    font-size:12px;
    font-family:arial,sans-serif;
    letter-spacing:2px;
}
.my_left_category h1{
    background-image:url(images/spring_06.gif);
    height:20px;
    background-repeat:no-repeat;
    font-size:14px;
    font-weight:bold;
    padding-left:15px;
    padding-top:8px;
    margin:0px;
    color:#FFF;
}
.my_left_category .my_left_cat_list{
width:148px;
border-color:#b60134;
border-style:solid;
border-width:0px 1px 1px 1px;
line-height:13.5pt;
}
.my_left_category .my_left_cat_list h2 {
margin:0px;
padding:3px 5px 0px 9px;
}
.my_left_category .my_left_cat_list h2 a {
color:#d6290b;
font-weight:bold;
font-size:14px;
line-height:22px;
}
.my_left_category .my_left_cat_list h2 a:hover {
color:#d6290b;
font-weight:bold;
font-size:14px;
line-height:22px;
}
.my_left_category .h2_cat{
  width:148px;
  height:26px; 
  background-image:url(images/my_menubg.gif);
  background-repeat:no-repeat; 
  line-height:26px;
  font-weight:normal;
  color:#333333;
  position:relative;
}
.my_left_category .h2_cat_1{
  width:148px;
  height:26px; 
  background-image:url(images/my_menubg_1.gif);
  background-repeat:no-repeat; 
  line-height:26px;
  font-weight:normal;
  color:#333333;
  position:relative;
}
.my_left_category a{
  font:12px;
  text-decoration:none;
  color:#333333;
}
.my_left_category a:hover{
  text-decoration:underline;
  color:#ff3333;
}
.my_left_category h3{
margin:0px; 
padding:0px;
height:26px; 
font-size:12px; 
font-weight:normal;
display:block; 
padding-left:8px;
}
.my_left_category h3 span{color:#999999; width:145px; float:right;}
.my_left_category h3 a{  line-height:26px;}
.my_left_category .h3_cat{
 display:none;
 width:204px;
 position:absolute; 
 left:123px; 
 margin-top:-26px; 
 cursor:auto;
}
.my_left_category .shadow{
position:inherit;
background:url(images/shadow_04.gif) left top;
width:204px;
}
.my_left_category .shadow_border{
position:inherit; 
width:200px; 
border:1px solid #959595; margin-top:1px; 
border-left-width:0px; 
background:url(images/shadow_border.gif) no-repeat 0px 21px; 
background-color:#ffffff; 
margin-bottom:3px
}
.my_left_category .shadow_border ul{margin:0; padding:0; margin-left:15px}
.my_left_category .shadow_border ul li {
list-style:none;
padding-left:10px;
background-image:url(images/my_cat_sub_menu_dot.gif);
background-repeat:no-repeat;
background-position:0px 8px;
float:left;
width:75px;
height:26px;
overflow:hidden;
letter-spacing:0px;
} 
.my_left_category .active_cat{ z-index:99;background-position:0 -25px;cursor:pointer;}
.my_left_category .active_cat h3 { font-weight:bold}
.my_left_category .active_cat h3 span{ display:none;} 
.my_left_category .active_cat p{display:block;} 
</style>
</head>
<body>
<p class="my_left_category">
  <h1 id="分类导航">分类导航</h1>
  <p class="my_left_cat_list">
    <h2 id="a-nbsp-href-按网站类别-a"><a href="#">按网站类别</a></h2>
    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">
      <h3 id="a-nbsp-href-企业建站-a"><a href="#">企业建站</a></h3>
      <p class="h3_cat">
         <p class="shadow">
          <p class="shadow_border">
            <ul>
             <li><a href="#">LOGO设计</a></li>
             <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>
             <li><a href="#">网站建设</a></li>
             <li><a href="#">SEO</a></li>
            </ul>
          </p>
         </p>
      </p>    
    </p> 
    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">
      <h3 id="a-nbsp-href-韩国男装-a"><a href="#">韩国男装</a></h3>
      <p class="h3_cat">
        <p class="shadow">
          <p class="shadow_border">
            <ul>
             <li><a href="#">LOGO设计</a></li>
             <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>
             <li><a href="#">网站建设</a></li>
             <li><a href="#">SEO</a></li>
            </ul>
          </p>
        </p>  
      </p>    
    </p> 
    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">
      <h3 id="a-nbsp-href-脚本之家-a"><a href="#">脚本之家</a></h3>
      <p class="h3_cat">
        <p class="shadow">
          <p class="shadow_border">
            <ul>
             <li><a href="#">LOGO设计</a></li>
             <li><a href="#">源码下载</a></li>
             <li><a href="#">最新更新</a></li>
             <li><a href="#">下载排行</a></li>
             <li><a href="#">ASP</a></li>
             <li><a href="#">PHP</a></li>
             <li><a href="#">AJAX</a></li>
             <li><a href="#">DELPHI</a></li>
            </ul>
          </p>
        </p>  
      </p>    
    </p> 
<!-- again -->
    <h2 id="a-nbsp-href-按品牌选货-a"><a href="#">按品牌选货</a></h2>
    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">
      <h3 id="a-nbsp-href-nbsp-style-color-ff-热销推荐-a"><a href="#" style="color:#ff3333;">热销推荐</a></h3>
      <p class="h3_cat">
         <p class="shadow">
          <p class="shadow_border">
            <ul>
             <li><a href="#">LOGO设计</a></li>
             <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>
             <li><a href="#">网站建设</a></li>
             <li><a href="#">SEO</a></li>
            </ul>
          </p>
         </p>
      </p>    
    </p> 
    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">
      <h3 id="a-nbsp-href-网站建设-a"><a href="#">网站建设</a></h3>
      <p class="h3_cat">
        <p class="shadow">
          <p class="shadow_border">
            <ul>
             <li><a href="#">LOGO设计</a></li>
             <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>
             <li><a href="#">LOGO设计</a></li>
             <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>
             <li><a href="#">网站建设</a></li>
             <li><a href="#">LOGO设计</a></li>
             <li><a href="#">网站设计</a></li>
             <li><a href="#">网站建设</a></li>
             <li><a href="#">SEO</a></li>
            </ul>
          </p>
        </p>  
      </p>    
    </p> 
    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">
      <h3 id="a-nbsp-href-网站程序-a"><a href="#">网站程序</a></h3>
      <p class="h3_cat">
        <p class="shadow">
          <p class="shadow_border">
            <ul>
             <li><a href="#">PHP</a></li>
             <li><a href="#">ASP</a></li>
             <li><a href="#">JSP</a></li>
             <li><a href="#">ASP.Net</a></li>
            </ul>
          </p>
        </p>  
      </p>    
    </p> 
    <p class="h2_cat_1" onmouseover="this.className=&#39;h2_cat_1 active_cat&#39;" onmouseout="this.className=&#39;h2_cat_1&#39;">
      <h3 id="a-nbsp-href-其他网站-a"><a href="#">其他网站</a></h3>
    </p>
  <!-- again -->
    <h2 id="a-nbsp-href-按价格选货-a"><a href="#">按价格选货</a></h2>
    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">
      <h3 id="a-nbsp-href-低端价位-a"><a href="#">低端价位</a></h3>
      <p class="h3_cat">
         <p class="shadow">
          <p class="shadow_border">
            <ul>
             <li><a href="#">50元以下</a></li>
             <li><a href="#">50-100元</a></li>
            </ul>
          </p>
         </p>
      </p>    
    </p> 
    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">
      <h3 id="a-nbsp-href-中高端价位-a"><a href="#">中高端价位</a></h3>
      <p class="h3_cat">
        <p class="shadow">
          <p class="shadow_border">
            <ul>
             <li><a href="#">100-150元</a></li>
             <li><a href="#">150-200元</a></li>
             <li><a href="#">200-300元</a></li>
             <li><a href="#">300元以上</a></li>
             </ul>
          </p>
        </p>  
      </p>    
    </p> 
      <!-- again -->
    <h2 id="a-nbsp-href-超值特价区-a"><a href="#">超值特价区</a></h2>
    <h2 id="a-nbsp-href-现货区-a"><a href="#">现货区</a></h2>
<!--测试复制end-->    
 </p>
 </p> 
</body>
</html>

The above is the entire content of this article, I hope it will be useful for everyone's learning For help, please pay attention to the PHP Chinese website for more related content!

Related recommendations:

How to use CSS to achieve a black navigation menu effect with shadow effect

CSS3 area Relevant code of module region

The above is the detailed content of DIV and CSS realize the effect of imitating the navigation bar of Jingdong Mall. 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
Orbital Mechanics (or How I Optimized a CSS Keyframes Animation)Orbital Mechanics (or How I Optimized a CSS Keyframes Animation)May 09, 2025 am 09:57 AM

What does it look like to refactor your own code? John Rhea picks apart an old CSS animation he wrote and walks through the thought process of optimizing it.

CSS Animations: Is it hard to create them?CSS Animations: Is it hard to create them?May 09, 2025 am 12:03 AM

CSSanimationsarenotinherentlyhardbutrequirepracticeandunderstandingofCSSpropertiesandtimingfunctions.1)Startwithsimpleanimationslikescalingabuttononhoverusingkeyframes.2)Useeasingfunctionslikecubic-bezierfornaturaleffects,suchasabounceanimation.3)For

@keyframes CSS: The most used tricks@keyframes CSS: The most used tricksMay 08, 2025 am 12:13 AM

@keyframesispopularduetoitsversatilityandpowerincreatingsmoothCSSanimations.Keytricksinclude:1)Definingsmoothtransitionsbetweenstates,2)Animatingmultiplepropertiessimultaneously,3)Usingvendorprefixesforbrowsercompatibility,4)CombiningwithJavaScriptfo

CSS Counters: A Comprehensive Guide to Automatic NumberingCSS Counters: A Comprehensive Guide to Automatic NumberingMay 07, 2025 pm 03:45 PM

CSSCountersareusedtomanageautomaticnumberinginwebdesigns.1)Theycanbeusedfortablesofcontents,listitems,andcustomnumbering.2)Advancedusesincludenestednumberingsystems.3)Challengesincludebrowsercompatibilityandperformanceissues.4)Creativeusesinvolvecust

Modern Scroll Shadows Using Scroll-Driven AnimationsModern Scroll Shadows Using Scroll-Driven AnimationsMay 07, 2025 am 10:34 AM

Using scroll shadows, especially for mobile devices, is a subtle bit of UX that Chris has covered before. Geoff covered a newer approach that uses the animation-timeline property. Here’s yet another way.

Revisiting Image MapsRevisiting Image MapsMay 07, 2025 am 09:40 AM

Let’s run through a quick refresher. Image maps date all the way back to HTML 3.2, where, first, server-side maps and then client-side maps defined clickable regions over an image using map and area elements.

State of Devs: A Survey for Every DeveloperState of Devs: A Survey for Every DeveloperMay 07, 2025 am 09:30 AM

The State of Devs survey is now open to participation, and unlike previous surveys it covers everything except code: career, workplace, but also health, hobbies, and more. 

What is CSS Grid?What is CSS Grid?Apr 30, 2025 pm 03:21 PM

CSS Grid is a powerful tool for creating complex, responsive web layouts. It simplifies design, improves accessibility, and offers more control than older methods.

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

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools