<!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等

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.

ToinsertanimageintoanHTMLpage,usethetagwithsrcandaltattributes.1)UsealttextforaccessibilityandSEO.2)Implementsrcsetforresponsiveimages.3)Applylazyloadingwithloading="lazy"tooptimizeperformance.4)OptimizeimagesusingtoolslikeImageOptimtoreduc

The core purpose of HTML is to enable the browser to understand and display web content. 1. HTML defines the web page structure and content through tags, such as, to, etc. 2. HTML5 enhances multimedia support and introduces and tags. 3.HTML provides form elements to support user interaction. 4. Optimizing HTML code can improve web page performance, such as reducing HTTP requests and compressing HTML.

HTMLtagsareessentialforwebdevelopmentastheystructureandenhancewebpages.1)Theydefinelayout,semantics,andinteractivity.2)SemantictagsimproveaccessibilityandSEO.3)Properuseoftagscanoptimizeperformanceandensurecross-browsercompatibility.

A consistent HTML encoding style is important because it improves the readability, maintainability and efficiency of the code. 1) Use lowercase tags and attributes, 2) Keep consistent indentation, 3) Select and stick to single or double quotes, 4) Avoid mixing different styles in projects, 5) Use automation tools such as Prettier or ESLint to ensure consistency in styles.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

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),

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
