二级菜单不能顶头_html/css_WEB-ITnose
<!DOCTYPE html ><html><head> <title></title> <style > #menu,#submenu{ font-family:微软雅黑; font-size:medium;}/*菜单字体*/ #menu{width:100%} #menu ul,#submenu ul{ list-style:none;} /*去掉列表的点*/ #menu ul li,#submenu ul li{ float:left; padding:10px; width:120px; text-align:center}/*横向显示*/ #submenu{ text-align:left; display: block; position: inherit;} #menu ul li:hover{ border-bottom-style:solid; border-bottom-color:rgba(0,0,255,.5); cursor:pointer; color:rgba(255,0,0,.5);} #menu ul li:active{border-bottom-style:none; border-bottom-color:Red;cursor:pointer;color:Red;} .subfirst{ float:left; display:none;} </style> <script src="jquery.2.1.4.min.js" type="text/javascript"></script> <script type="text/javascript"> function showsub(rootid) { hidesub(); $('#submenu' + rootid).show(); } function hidesub() { for (var i = 1; i <= 3; i++) { $('#submenu' + i).hide(); } } </script></head><body> <div id="menu"> <ul> <li id="menu1" onmouseover="showsub(1)";">根菜单一</li> <li id="menu2" onmouseover="showsub(2)";">根菜单二</li> <li id="menu3" onmouseover="showsub(3)";">根菜单三</li> </ul> </div> <div id="submenu"> <ul id="submenu1" class="subfirst"> <li id="menu11">二级菜单1-1</li> <li id="menu12">二级菜单1-2</li> <li id="menu13">二级菜单1-3</li> </ul> <ul id="submenu2" class="subfirst"> <li id="menu21">二级菜单2-1</li> <li id="menu22">二级菜单2-2</li> <li id="menu23">二级菜单2-3</li> </ul> <ul id="submenu3" class="subfirst"> <li id="menu31">二级菜单3-1</li> <li id="menu32">二级菜单3-2</li> <li id="menu33">二级菜单3-3</li> </ul> </div></body></html>
二级菜单不能顶头是什么没有设置好,设置了div百分百的宽度,还是接着后面显示了
想让二级菜单换行显示,CSS怎么控制
回复讨论(解决方案)
#submenu{ text-align:left; display: block; position: inherit;clear: both;}
可以使用绝对布局position:absloute
然后设置left,top等

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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

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

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

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.

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

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

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit
