search
HomeWeb Front-endHTML Tutorialcss怎么做下拉菜单?_html/css_WEB-ITnose

RT怎么做下拉菜单


回复讨论(解决方案)

http://www.17sucai.com/boards/16.html

<!doctype html><html lang="en"><head>	<meta charset="UTF-8" />	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />	<title> 页面名称 </title><style type="text/css">#text {	width: 150px;	height: 20px;	position: relative;	background: #33CCCC;}#text div {	width: 150px;	height: 200px;	position: absolute;	top: 20px;	left: 0;	background: #009999;	display: none;}#text:hover div {	display: block;}</style></head><body><div id="text">	文本	<div>		菜单1<br>		菜单2<br>		菜单3<br>		菜单4<br>		菜单5<br>	</div></div></body></html>

从: http://bbs.csdn.net/topics/391893015 帖子到现在这个帖子,完全可以百度搜索就能解决。
唯一能说的就是,css制作的下拉菜单不兼容,css到目前为止就是承担页面表现这个角色。跟用户交互类的事情就是js所承担的。
所以,我个人建议的搜索关键字是:js 下拉菜单

 <script type="text/javascript">$(function(){    $(".z").mouseover(function(){        $(this).find("ul:hidden").slideDown(400);          });      $(".z").mouseleave(function(){        $(this).find("ul:visible").slideUp(100);        });              });</script>



下面是html
<ul class="navs">      <li class=" z lia"><a href="/">首页</a>  </li>	 <li class="z li_hover"><a href='javascript:;' title="关于我们">关于我们</a> 		<ul class="nav_s">			             <li><a href='/group/' title='集团简介'  >集团简介</a></li>                          <li><a href='/fxs/' title='汉德森分析师'  >汉德森分析师</a></li>                          <li><a href='/xhintro/' title='新华大宗'  >新华大宗</a></li>                          <li><a href='/contact/' title='联系我们'  >联系我们</a></li>                      </ul>	</li><li class="z "><a href='javascript:;' title="石油投资">石油投资</a> 		<ul class="nav_s">			             <li><a href='/prointro/' title='产品简介'  >产品简介</a></li>                          <li><a href='/advantage/' title='投资优势'  >投资优势</a></li>                          <li><a href='/guige/' title='交易规格'  >交易规格</a></li>                          <li><a href='/calculate/' title='盈亏计算'  >盈亏计算</a></li>                          <li><a href='/process/' title='收益流程'  >收益流程</a></li>                      </ul>	</li><li class="z "><a href='javascript:;' title="行情资讯">行情资讯</a> 		<ul class="nav_s">			             <li><a href='/suggestion/' title='操作建议'  >操作建议</a></li>                          <li><a href='/news/' title='国际动态'  >国际动态</a></li>                          <li><a href='/view/' title='机构观点'  >机构观点</a></li>                          <li><a href='/finance/' title='财经快讯'  >财经快讯</a></li>                      </ul>	</li><li class="z "><a href='javascript:;' title="网上开户">网上开户</a> 		<ul class="nav_s">			             <li><a href='#'新华油开户' target='_blank' >新华油开户</a></li>                      </ul>	</li><li class="z "><a href='javascript:;' title="软件下载">软件下载</a> 		<ul class="nav_s">			             <li><a href='#' title='电脑端'  >电脑端</a></li>                          <li><a href='#' title='手机端'  >手机端</a></li>                      </ul>	</li><li class="z "><a href='javascript:;' title="签约银行">签约银行</a> 		<ul class="nav_s">			             <li><a href='http://www.abchina.com/cn/' title='农业银行' target='_blank' >农业银行</a></li>                          <li><a href='http://www.hzbank.com.cn/' title='杭州银行' target='_blank' >杭州银行</a></li>                          <li><a href='http://www.icbc.com.cn/icbc/' title='工商银行' target='_blank' >工商银行</a></li>                          <li><a href='http://www.cebbank.com/' title='光大银行' target='_blank' >光大银行</a></li>                      </ul>	</li><li class="z "><a href='javascript:;' title="VIP活动">VIP活动</a> 		<ul class="nav_s">			             <li><a href='#' title='VIP活动' target='_blank' >VIP活动</a></li>                      </ul>	</li>   </ul> 


css就自己写  ,参考下那段jq

css有动画功能,,,可以试试看。。。

ul ul { visibility:hidden; }
li:hover ul { visibility:visible; }

如果要动画效果的话可以加上css3 的 transform 

先写一个下拉菜单的层,display=none
然后鼠标经过出现该层,display=block

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
HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

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

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools