Home Web Front-end CSS Tutorial About CSS to achieve beautiful drop-down navigation effect

About CSS to achieve beautiful drop-down navigation effect

Jun 25, 2018 pm 02:45 PM
css Drop down navigation

This article mainly introduces you to the code for realizing beautiful drop-down navigation effect using pure CSS. It realizes the drop-down menu navigation effect through simple CSS style setting and response to mouse events. It is of great practical value. Friends who need it can refer to it.

The example in this article describes the code to achieve beautiful drop-down navigation effect using pure CSS. Share it with everyone for your reference. The details are as follows:

This is a drop-down navigation code completed with pure CSS. It has a classic blue tone and is very atmospheric. It is suitable for government and enterprise websites as the top navigation menu. Browser compatibility is OK. If necessary Friends can take it.

The screenshot of the running effect is as follows:

The specific code is as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD id=Head1>
<TITLE>纯CSS下拉菜单</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<style>
* {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
UL {
    LIST-STYLE-TYPE: none
}
LI {
    LIST-STYLE-TYPE: none
}
DL {
    LIST-STYLE-TYPE: none
}
DD {
    LIST-STYLE-TYPE: none
}
DT {
    LIST-STYLE-TYPE: none
}
A {
    COLOR: #414141; TEXT-DECORATION: none
}
IMG {
    DISPLAY: inline-block; FONT-SIZE: 12px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none
}
A:hover {
    COLOR: #c51007
}
#dangqian A {
    COLOR: #c51007
}
.clear {
    CLEAR: both
}
.warper {
    MARGIN: 0px auto; WIDTH: 1000px
}
.menu {
    MARGIN-TOP: 3px; FONT-SIZE: 12px; BACKGROUND: url(images/menu_02.gif) repeat-x; LINE-HEIGHT: 28px; HEIGHT: 28px
}
.menu_01 {
    FLOAT: left
}
.menu_02 {
    FLOAT: right
}
.menu A {
    FONT-WEIGHT: bold; COLOR: #fff
}
.menu A:hover {
    COLOR: #b8def6
}
.menu DL {
    FLOAT: left
}
.menu DD {
    FLOAT: left; WIDTH: 132px; TEXT-ALIGN: center
}
.menu DT {
    PADDING-LEFT: 1px; BACKGROUND: url(images/menu_04.gif) no-repeat left top; FLOAT: left; WIDTH: 122px; POSITION: relative; HEIGHT: 28px; TEXT-ALIGN: center
}
.menuli_p {
    BACKGROUND: #0068aa; LEFT: 1px; PADDING-BOTTOM: 8px; WIDTH: 122px; POSITION: absolute; TOP: 28px
}
.menuli_p LI {
    BACKGROUND: url(images/menu_05.gif) no-repeat center bottom; PADDING-BOTTOM: 1px; LINE-HEIGHT: 24px; HEIGHT: 24px
}
.menu DT UL LI A {
    FONT-WEIGHT: normal
}
.menuli .menuli_p {
    DISPLAY: none
}
.menuli_hover .menuli_p {
    DISPLAY: block
}
</style>
<BODY onselectstart="return false">
<p class=warper>
<p class=menu><DL>
 <DD><A href="#" target=_self>首页</A></DD>
 <DT class=menuli onMouseOver="this.className=&#39;menuli_hover&#39;" 
 onmouseout="this.className=&#39;menuli&#39;"><A href="#" 
 target=_self>关于家乡网</A>
 <UL class=menuli_p>
  <LI><A href="#">About</A></LI>
    <LI><A href="#">家乡网</A></LI>
    <LI><A href="#">中国网</A></LI>
    <LI><A href="#">大武汉</A></LI>
    </UL></DT>
 <DT class=menuli onMouseOver="this.className=&#39;menuli_hover&#39;" 
 onmouseout="this.className=&#39;menuli&#39;"><A href="#" 
 target=_self>资讯动态</A>
 <UL class=menuli_p>
  <LI><A href="#">省内</A></LI>
    <LI><A href="#">省外</A></LI>
    </UL></DT>
 <DT class=menuli onMouseOver="this.className=&#39;menuli_hover&#39;" 
 onmouseout="this.className=&#39;menuli&#39;"><A 
 href="#" target=_self>组织机构</A>
 <UL class=menuli_p>
      <LI><A href="#">省委</A></LI>
    <LI><A href="#">政府</A></LI>
    <LI><A href="#">政协</A></LI>
    </UL></DT>
 <DT class=menuli onMouseOver="this.className=&#39;menuli_hover&#39;" 
 onmouseout="this.className=&#39;menuli&#39;"><A 
 href="#" target=_self>主营业务</A>
 <UL class=menuli_p>
  <LI><A href="#">淘宝</A></LI>
    <LI><A href="#">手机</A></LI>
    <LI><A href="#">相机</A></LI>
    <LI><A href="#">电脑</A></LI>
    </UL></DT>
 <DT class=menuli onMouseOver="this.className=&#39;menuli_hover&#39;" 
 onmouseout="this.className=&#39;menuli&#39;"><A href="#" 
 target=_self>品牌战略</A>
 <UL class=menuli_p>
  <LI><A href="#">一杯水</A></LI>
    <LI><A href="#">城市生活</A></LI>
    <LI><A href="#">家乡网</A></LI>
    </UL></DT>
 <DT class=menuli onMouseOver="this.className=&#39;menuli_hover&#39;" 
 onmouseout="this.className=&#39;menuli&#39;"><A href="#" 
 target=_self>人才招聘</A>
 <UL class=menuli_p>
  <LI><A href="#">我的家</A></LI>
    <LI><A href="#">家乡网</A></LI>
    </UL></DT>
 <DT class=menuli onMouseOver="this.className=&#39;menuli_hover&#39;" 
 onmouseout="this.className=&#39;menuli&#39;"><A 
 href="#" target=_self>联系我们</A>
 <UL class=menuli_p>
  <LI><A href="#">联系我</A></LI>
  <LI><A href="#">联系她</A></LI>
    <LI><A href="#">我的家</A></LI>
  </UL></DT></DL></p>
</BODY>
</HTML>
Copy after login

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!

The above is the detailed content of About CSS to achieve beautiful drop-down navigation effect. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to use bootstrap button How to use bootstrap button Apr 07, 2025 pm 03:09 PM

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

See all articles