


First of all, the three-column layout of equal heights, as the name suggests, can be summarized as the following characteristics:
1. 3 columns (idiots also know)
2. These 3 columns are of equal height
3. The height of these three columns is not fixed, but changes with the change of content
Step 1:
xhtml code:
<div id="header">#header</div>
<div id="container">
<div id="main" class="column">#main </div>
<div id="left" class="column">#left</div>
<div id="right" class="column">#right </div>
</div>
<div id="footer">#footer</div>
The main structural formula is the div of #container, as for #header and #footer are all to make it more like a web page. Back to #container, it contains three columns. The main contains the core and main content of a web page, so we cannot neglect it. In pure xhtml In the flow document, the browser parses it from top to bottom, so the important content should be placed relatively early. This is determined by the weight of the search engine, but visually, we will discuss it later. Put it in the middle.
Think about it: How can these three columns move together intelligently without specifying the height?
In fact, if you don’t write the height, you can’t keep pace with intelligence. So how to write the height? The answer is to use the box model to write its padding. This is a perverted method, but it works. It's like a person is actually only 170cm, but including 20cm of hair, oh my god, he is already 190cm. Let's give a solution first: use padding-bottom and margin-bottom;
Step2 :
#container {
background-image: url('bg.gif');
width: 960px;
margin: 0 auto;
}
#main{float: left: width: 500px;background-color: #e5e5e5;}
#left{float: left: width: 300px;background -color: #7bd;}
#right{float: right: width: 160px;background-color: #f63;}
Step3:
#container .column {
padding-bottom: 32767px;
margin-bottom: -32767px; You can understand this number as "big enough" so that there is enough space to expand its box. It should be gigantism when it is so high. It doesn't matter. We can use the negative value of margin-bottom to hide it. This technique is used in In my opinion, I really can’t explain it clearly. There is an old saying: Understanding comes through words! Just try it and you'll understand the secret. The picture below should be helpful for your understanding:
At this step, you will find that the box model of these three columns is 32767px. At this time, you need to add: overflow: hidden; of course IE6.0 is: zoom:1;
#container {
background-image: url('bg.gif');
width: 960px;
margin: 0 auto;
overflow: hidden;
}
Step4:
Now the visual effect of #main is in the leftmost column, we have to find a way to make it in the middle
Idea: First arrange #main to the middle, we can #main{margin-left:300}, at this time, #left is squeezed to the position of 800px, at #left{margin-left:-800px ;} It can be done, but it's a pity that IE6 is such a bitch. I am really speechless and have to think again.
Generally, when doing layout in CSS, there are several ideas, one is float, the other is positioning. Regarding positioning, if you are not familiar with it, just google it. Let me mention: position: relative; Attribute, if top and left are not specified, its visual effect will not change.
Therefore, in order to make #main a breakthrough in visual effects, you must specify top or left. Here you only need to specify left,
#main {
float: left;
background-color: #e5e5e5;
width: 500px;
left: 300px; > #left {
float: left;
background-color: #7bd;
width: 300px;
left: -500px; >
}
In fact, there is another concept that is more important in the middle. #main, #left After position: relative, there is the concept of layer, so when #main{left :300px}, #left has become independent and will not be squeezed to the 800px position. Therefore: it needs left:-500px to reach the left side, and 500 is the width of #main.
The last consideration is backward compatibility,
Provide a piece of code:
Although I have written so much, just because you can do it, it does not mean that you should do it. It is a question of tactics and strategy. Here is what I personally want to know:
I think at the beginning:
padding-bottom: 32767px;
margin-bottom: - 32767px;
With such a large value, will it consume a lot of resources during the reflow stage? Would it be easier to use js to control their height?
It’s the first time I write something like this, and I find it very tricky. It’s still very obscure both in terms of conception and language expression. I hope everyone will actively correct me and hope to communicate with more friends. , on the one hand, it is to improve oneself, on the other hand, it is to promote the harmony and sharing of the community and do one's own meager strength.

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.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.


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

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.

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.