aaaa
aaaa
is dynamically changing div id=aaa height and width are fixed
I want to achieve that no matter how many aaaa
aaaa
the height and width of the div id=bbb are automatically adapted
the excess part of the div id=bbb will have horizontal and vertical scroll bars
Currently I The scroll bar appearing in the parent div is not what I want. Heroes, please help me adjust it
<div id="aaa" style="height: 150px;width: 300px;border: 1px solid #b4c9c6;margin: 4px 0 0 3px;background-color: #ffffff; overflow: auto;">aaaa<br/>aaaa<br/>aaaa<br/>aaaa<br/><div id="bbb" style="SCROLLBAR-FACE-COLOR: #D5DEDB; SCROLLBAR-HIGHLIGHT-COLOR: #e9f5f8; OVERFLOW: auto; SCROLLBAR-SHADOW-COLOR: #ffffff; SCROLLBAR-3DLIGHT-COLOR: #deeb9f; SCROLLBAR-ARROW-COLOR: #123456; SCROLLBAR-TRACK-COLOR: #fcfdfd; SCROLLBAR-DARKSHADOW-COLOR: #deeb9f;width:100%;height:100%"><table cellspacing="0" rules="all" border="1" style="border-color:#D8E4F8;width:787px;border-collapse:collapse;"> <tr align="center" style="color:#404040;background-color:#E0E0E0;font-weight:normal;height:28px;"> <th scope="col" style="font-weight:normal;width:180px;"></th><th align="center" scope="col" style="font-weight:normal;"></th><th align="center" scope="col" style="font-weight:normal;width:60px;"><a href="javascript:__doPostBack('dg','Sort$pen03')" style="color:#404040;"></a></th><th align="center" scope="col" style="font-weight:normal;width:140px;"><a href="javascript:__doPostBack('dg','Sort$pen04')" style="color:#404040;"></a></th><th align="center" scope="col" style="font-weight:normal;width:60px;"></th><th align="center" scope="col" style="font-weight:normal;width:140px;"></th> </tr><tr style="height:24px;"> <td align="left" style="width:180px;"> </td><td align="left"></td><td align="center" style="width:60px;"> </td><td align="center" style="width:140px;"> </td><td align="center" style="width:60px;"> </td><td align="center" style="width:140px;"> </td> </tr><tr style="height:24px;"> <td align="left" style="width:180px;"> </td><td align="left"></td><td align="center" style="width:60px;"> </td><td align="center" style="width:140px;"> </td><td align="center" style="width:60px;"></td><td align="center" style="width:140px;"></td> </tr><tr style="height:24px;"> <td align="left" style="width:180px;"> </td><td align="left"></td><td align="center" style="width:60px;"></td><td align="center" style="width:140px;"></td><td align="center" style="width:60px;"></td><td align="center" style="width:140px;"></td> </tr><tr style="height:24px;"> <td align="left" style="width:180px;"> </td><td align="left"> </td><td align="center" style="width:60px;"> </td><td align="center" style="width:140px;"> </td><td align="center" style="width:60px;"> </td><td align="center" style="width:140px;"> </td> </tr><tr style="height:24px;"> <td align="left" style="width:180px;"> </td><td align="left"> </td><td align="center" style="width:60px;"> </td><td align="center" style="width:140px;"> </td><td align="center" style="width:60px;"> </td><td align="center" style="width:140px;"> </td> </tr></table></div></div>
Reply to the discussion (solution)
Your div id=bbb The height and width automatically adapt, but the excess part of the div with id=bbb will have horizontal and vertical scroll bars. This is difficult to achieve. You can make aaa have scroll bars after exceeding the height of aaa
Change the div id=bbb height :100% to height:70px is the effect I want
But this is hard-coded and will not automatically change according to aaaa
aaaa
The height and width of your div id=bbb will automatically adapt, but the div with div id=bbb will have horizontal and vertical scroll bars in the excess part. This is difficult to achieve. You can make aaa have a scroll bar when it exceeds the height of aaa. =bbb Changing height:100% to height:70px is the effect I want
But this is hard-coded and will not automatically change according to aaaa
aaaa
Is it impossible to call a master?
#bbb{height:100%;width:100%;overflow:scroll;}
<table style="width:200px;height:200px;border:1px solid #84C1FF;margin:50px auto;overflow: hidden"> <tr> <td> <div style="float: left"> asdfasfsadfa<br/> asdfasfsadfa<br/> asdfasfsadfa<br/> asdfasfsadfa<br/> asdfasfsadfa<br/> </div> </td> </tr> <tr> <td> <div style="height: 100%;width: 100%;overflow: auto"> <table> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> </table> </div> </td> </tr> </table>
The two brothers upstairs, have you run the html code? It doesn’t work.
The two brothers upstairs, have you run the html code? It doesn’t work.
The row height and column width of your table should be Use percentage settings, otherwise the table will adapt to the external height, and the elements inside you will still be fixed. Of course it will be useless
Sorry, I misunderstood your request
According to your request, I can only use js Calculate the height of aaaa
aaaa
, and then calculate the height required for #bbb
Why do I feel like I don’t understand what you mean?
Your code looks like this.
It seems that the result is the same as what you want, no problem.
At the same time, I also tried it. You said setting the height of div=bbb to 70px has the same effect. There is no difference.
You don’t want the scroll bars to be displayed when the page is initialized? Even if you set the height to 70px, after adding your aaaa
, add a few more, bbb will still go down. Since it needs to be adaptive, what is the problem with the current effect?
Or maybe, I don’t understand what effect you want to achieve.
Brothers upstairs, have you run the html code? It doesn’t work.
<table style="width:200px;height:200px;border:1px solid #84C1FF;margin:50px auto;overflow: hidden"> <tr> <td> <div style="float: left"> asdfasfsadfa<br/> asdfasfsadfa<br/> asdfasfsadfa<br/> asdfasfsadfa<br/> asdfasfsadfa<br/> </div> </td> </tr> <tr> <td> <div style="height: 100%;width: 200px;overflow: auto"> <table> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> <tr><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td><td>aaaaaaaaaaaaa</td></tr> </table> </div> </td> </tr></table>
Chrome is good.
Why do I feel like I don’t understand what you mean?
Your code looks like this.
It seems that the result is the same as what you want, no problem.
At the same time, I also tried it. You said that setting the height of div=bbb to 70px has the same effect. There is no difference.
You don’t want the scroll bars to be displayed when the page is initialized? Even if you set the height to 70px, after adding your aaaa
, add a few more, bbb will still run down. Since it needs to be adaptive, what is the problem with the current effect?
Or maybe, I don’t understand what effect you want to achieve.
The screenshot you took is set to 70px. I tried it myself
The effect you want is impossible to achieve when the height of the parent element is certain
Try adding a few more aaaa
Even if it is 70px, the horizontal scroll bar will not be displayed.
If you insist on such an effect, then use the fixed positioning of the DIV to simulate it, and then use JS to control the simulated scroll bar.
But the complexity will be very high.
It seems that the height can only be hard-coded and cannot be achieved through a certain attribute. The picture you captured is set to 70px. I tried it myself
The effect you want is in When the height of the parent element is certain, it is impossible to achieve
Try adding a few more aaaa
. Even if it is 70px, the horizontal scroll bar will not be displayed.
If you insist on such an effect, then use the fixed positioning of the DIV to simulate it, and then use JS to control the simulated scroll bar.
But the complexity will be very high.
You can’t even write it to death
What you said aaaa
there is an indefinite number, you can add a few more, or use 70px to see the effect, it is still the same as you now The desired effect is different.
This is not a question of writing it to death or not.

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.

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

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.

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

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.

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.


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

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.

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

Dreamweaver CS6
Visual web development tools

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

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment