Home Web Front-end HTML Tutorial 'Mastering CSS' An example of a drop-down menu_html/css_WEB-ITnose

'Mastering CSS' An example of a drop-down menu_html/css_WEB-ITnose

Jun 24, 2016 am 11:53 AM

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>
Copy after login

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)

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

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 &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

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.

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 &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

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 &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

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.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

See all articles