<div style="height: 200px; width: 100%; overflow: auto; position: relative;" id="div1"> <div style="height: 2000000px; width: 1000px;" id="hugeDiv"> </div> XXXXXXXXXX</div>
高度被设置为2000000px,在IE8中查看的时候始终是:height: 1342177.27px;
被变成了:
FF和chrome都没这个问题
大家能解释下这是为什么不?该怎么处理?
回复讨论(解决方案)
<!DOCTYPE HTML><html lang=""><head> <meta charset="gbk"> <title></title></head><body> <div style="height: 200px; width: 100%; overflow: auto; position: relative;" id="div1"> <div style="height: 2000000px; width: 1000px;" id="hugeDiv"></div> XXXXXXXXXX </div> <script type="text/javascript"> alert( document.getElementById('hugeDiv').offsetHeight ) </script></body></html>
没问题啊
HTML code
nbsp;HTML>
我刚才试了你的代码,alert的值是1193046.
你确定是IE8吗?这个只能在IE里重现
应该就是个显示上限的问题吧
比如
<!DOCTYPE HTML><html lang=""><head> <meta charset="gbk"> <title></title></head><body> <div style="height: 200px; width: 100%; overflow: auto; position: relative;" id="div1"> <div style="height: 123456789px; width: 1000px;" id="hugeDiv"></div> XXXXXXXXXX </div> <div id="test"></div> <script type="text/javascript"> document.getElementById('test').innerHTML = document.getElementById('hugeDiv').offsetHeight; </script></body></html>
这里 ff 直接 显示0, ie6 显示123456789,ie8 显示1193046
而改成 12345678,
那么ff和ie6显示 12345678, ie8依然是1193046
改成 然后 滚动条的高度并非真实的1,193,046 px, 如果是真的那么高,拉滚动条岂不是要拉哭?
具体 DOM的高度上限是多少没研究过。
正需要
应该就是个显示上限的问题吧
比如
HTML code
nbsp;HTML>
我也偏向于认为是个显示上限的问题。想找到一些比较官方的文档看看,不知可否推荐一些关于浏览器方面的书籍?

HTMLtagsareessentialforstructuringwebpages,enhancingaccessibility,SEO,andperformance.1)Theyareenclosedinanglebracketsandusedinpairstocreateahierarchicalstructure.2)SemantictagslikeandimproveuserexperienceandSEO.3)Creativetagslikeenabledynamicgraphics

Self-closingtagsinHTMLandXMLaretagsthatclosethemselveswithoutneedingaseparateclosingtag,simplifyingmarkupstructureandenhancingcodingefficiency.1)TheyareessentialinXMLforelementswithoutcontent,ensuringwell-formeddocuments.2)InHTML5,usageisflexiblebutr

To build a website with powerful functions and good user experience, HTML alone is not enough. The following technology is also required: JavaScript gives web page dynamic and interactiveness, and real-time changes are achieved by operating DOM. CSS is responsible for the style and layout of the web page to improve aesthetics and user experience. Modern frameworks and libraries such as React, Vue.js and Angular improve development efficiency and code organization structure.

Boolean attributes are special attributes in HTML that are activated without a value. 1. The Boolean attribute controls the behavior of the element by whether it exists or not, such as disabled disable the input box. 2.Their working principle is to change element behavior according to the existence of attributes when the browser parses. 3. The basic usage is to directly add attributes, and the advanced usage can be dynamically controlled through JavaScript. 4. Common mistakes are mistakenly thinking that values need to be set, and the correct writing method should be concise. 5. The best practice is to keep the code concise and use Boolean properties reasonably to optimize web page performance and user experience.

HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

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 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.


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

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

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

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