search
HomeWeb Front-endHTML Tutorial'Mastering CSS' An example of a drop-down menu_html/css_WEB-ITnose

This example is for a drop-down menu. I made a few changes. The principle is indeed very simple, but the author's code hierarchy is very clear and worth learning. Another point is the author's colors during the interaction process. Changes, even precise changes between border lines, although it is basically invisible from the perspective of an onlooker, this kind of meticulous thinking and design is worth learning and thinking about, the so-called subtle prescription Whether the skills are mature or not, I think this makes sense! Without further ado, here’s the code:

  1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  2 <html xmlns="http://www.w3.org/1999/xhtml">  3 <head>  4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  5 <title>滑动门航条</title>  6 <style type="text/css">  7     *{margin:30 0;padding: 0;list-style: none;}  8     ul.main,ul.main ul{  9         float:left; 10         border:1px solid #486B02; 11         background-color:#8BD400; 12         } 13     ul.main li{ 14         float:left; 15         width:120px; 16         height:30px; 17         line-height:30px; 18         text-align:center; 19         } 20     ul.main li ul{ 21         width:120px; 22         position:absolute;left:-999em; 23         } 24     ul.main li:hover ul{ 25         left:auto;//AUTO时它会自动悬浮在下方 26         } 27     ul.main a{ 28         display:block; 29         color:#2B3F00; 30         border-left:1px solid #E4FFD3; 31         border-right:1px solid #486B02; 32         text-decoration:none; 33         } 34     ul.main li li a{ 35         border-top:1px solid #E4FFD3; 36         border-bottom:1px solid #486B02; 37         border-left:0; 38         border-right:0; 39         } 40     ul.main li:last-child a{ 41         border-bottom:0; 42         border-right:0; 43         } 44     ul a:hover,ul a:focus{ 45         color:#E4FFD3; 46         background-color:#6DA203; 47         } 48 </style> 49 </head> 50 <body> 51     <ul class="main"> 52         <li><a href="#" class="selected">首页</a></li> 53         <li><a href="#">教学</a> 54             <ul> 55                 <li><a href="#">本科生教学</a></li> 56                 <li><a href="#">研究生教学</a></li> 57                 <li><a href="#">中小学教学</a></li> 58                 <li><a href="#">远程教育</a></li> 59             </ul> 60         </li> 61         <li><a href="#">科研</a> 62             <ul> 63                 <li><a href="#">论文发表</a></li> 64                 <li><a href="#">实验室</a></li> 65                 <li><a href="#">产品展示</a></li> 66             </ul> 67         </li> 68         <li><a href="#">后勤</a> 69             <ul> 70                 <li><a href="#">规章制度</a></li> 71                 <li><a href="#">资料下载</a></li> 72                 <li><a href="#">设施开放时间</a></li> 73                 <li><a href="#">通知公告</a></li> 74             </ul> 75         </li> 76         <li><a href="#">安全保障</a> 77                <ul> 78                 <li><a href="#">保卫处</a></li> 79                 <li><a href="#">网上报警</a></li> 80                 <li><a href="#">案件公示</a></li> 81             </ul> 82         </li> 83         <li><a href="#">关于我们</a> 84                <ul> 85                 <li><a href="#">学校简介</a></li> 86                 <li><a href="#">校歌校徽</a></li> 87                 <li><a href="#">校内导航</a></li> 88                 <li><a href="#">学校历史</a></li> 89                 <li><a href="#">学校荣誉</a></li> 90             </ul> 91         </li> 92         <li><a href="#">联系我们</a> 93             <ul> 94                 <li><a href="#">写邮件</a></li> 95                 <li><a href="#">联系电话</a></li> 96                 <li><a href="#">校区地址</a></li> 97             </ul> 98         </li> 99     </ul>100 </body>101 </html>

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
Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?Mar 04, 2025 pm 12:32 PM

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

How to efficiently add stroke effects to PNG images on web pages?How to efficiently add stroke effects to PNG images on web pages?Mar 04, 2025 pm 02:39 PM

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

How do I use HTML5 form validation attributes to validate user input?How do I use HTML5 form validation attributes to validate user input?Mar 17, 2025 pm 12:27 PM

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

What is the purpose of the <datalist> element?What is the purpose of the <datalist> element?Mar 21, 2025 pm 12:33 PM

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <progress> element?What is the purpose of the <progress> element?Mar 21, 2025 pm 12:34 PM

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

What are the best practices for cross-browser compatibility in HTML5?What are the best practices for cross-browser compatibility in HTML5?Mar 17, 2025 pm 12:20 PM

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

What is the purpose of the <meter> element?What is the purpose of the <meter> element?Mar 21, 2025 pm 12:35 PM

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

What is the purpose of the <iframe> tag? What are the security considerations when using it?What is the purpose of the <iframe> tag? What are the security considerations when using it?Mar 20, 2025 pm 06:05 PM

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment