http://topic.csdn.net/u/20120411/15/ae880ebf-f4cc-4152-9724-37fdfe14219c.html?64791
谁能解释下这是为毛??
回复讨论(解决方案)
加background 是为了触发layout
把 #b的position 去掉,不加background mouseleave也是可以了,问题就出现在position:absolute;
ie6解析怪异,不像DOM那样依旧认识#a下面#b的width及height
ie6只会认得内容来充满box,如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script src="http://code.jquery.com/jquery-latest.js"></script><style type="text/css"> *{margin:0;padding:0;}</style><script type="text/javascript"> $(document).ready(function(e) { $("#a").mouseover(function(e) { $("#b").slideDown(); }); $("#a").mouseleave(function(e) { $("#b").slideUp(); }); });</script></head><body><div id="a" style="position:relative;width:100px;height:30px;border:1px solid #cccccc;"> <div id="b" style="position:absolute;top:30px;left:0px;width:300px;height:400px;border:1px solid #cccccc;display:none;"> 1111111111111111111111 </div></div></body></html>
鼠标出了11111内容 box才会缩回去,所以这里加个background,让它充满整个box。
加background 是为了触发layout
把 #b的position 去掉,不加background mouseleave也是可以了,问题就出现在position:absolute;
ie6解析怪异,不像DOM那样依旧认识#a下面#b的width及height
ie6只会认得内容来充满box,如下:
HTML code
nbsp;html PUBLIC "-/……
+11
路过,学习,不同浏览器解析
推荐楼主少用JQ ,需然效果好,但是浏览器有些识别不了
$(document).ready(function(e) { $("#a").mouseover(function(e) { $("#b").slideDown(); }); $("#a").mouseleave(function(e) { var to = e.relatedTarget || e.toElement;//获得鼠标移出后进入的元素 alert(to.tagName) $("#b").slideUp(); }); });
去掉背景和不去掉背景分别高度一下
你就明白了
去掉背景和不去掉背景分别 运行一下
你就明白了
加background 是为了触发layout
把 #b的position 去掉,不加background mouseleave也是可以了,问题就出现在position:absolute;
ie6解析怪异,不像DOM那样依旧认识#a下面#b的width及height
ie6只会认得内容来充满box,如下:
HTML code
nbsp;html PUBLIC "-/……
总算明白了害死人的ie6哦
加background 是为了触发layout
把 #b的position 去掉,不加background mouseleave也是可以了,问题就出现在position:absolute;
ie6解析怪异,不像DOM那样依旧认识#a下面#b的width及height
ie6只会认得内容来充满box,如下:
HTML code
nbsp;html PUBLIC……
++

HTMLtagsdefinethestructureofawebpage,whileattributesaddfunctionalityanddetails.1)Tagslike,,andoutlinethecontent'splacement.2)Attributessuchassrc,class,andstyleenhancetagsbyspecifyingimagesources,styling,andmore,improvingfunctionalityandappearance.

The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

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.


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

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

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

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

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

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
