I just came into contact with this thing today. After reading many web pages, I can’t explain it clearly. I summarized it through my own experiments. Of course it is not comprehensive, but it feels really strange:
In fact, the following attributes are the most important:
float:left; position:relative; top:0px; left:10%; width:30%;
float: left is actually the reference point, which is the upper left corner. This should be more commonly used. In fact, this method can basically meet any requirement, but other methods may be more convenient in specific situations.
position:relative; Calculated relative to the parent or the upper left corner of the previous DIV.
top The Y coordinate of the upper left corner of this DIV relative to the previous DIV.
left has a strange calculation method. This value relative to the sum of the widths of the previous DIV is its own x coordinate, and the offset of the previous div is ignored. This means that you must know the x offset and width of the previous div to position it correctly.
The values of right and bottom are ignored directly. So what do you need this attribute for? It's like a control panel. You don't know which button can be used and which button can't be used, but they are all there.
The width and height of the child div are the same as the parent div by default. Even with x and y offsets, they still stick out stubbornly. The parent cannot cover the child div at all.
Reply to the discussion (solution)
The poster is obviously studying DIV CSS with some emotion. What you said is weird. Of course, I don’t think that is the case. The calculation method of left is, of course, just counting its own coordinates. Why should it calculate the offset of its parent div? If you really do it like this, it would be really weird.
I think that the DIV CSS method will gradually become mainstream, and table layout will become increasingly rare
The poster is obviously studying DIV CSS with some emotion. Of course you are weird. I don't think that's the case. The calculation method of left is, of course, just counting its own coordinates. Why should it calculate the offset of its parent div? If you really do it like this, it would be really weird.
I think that the DIV CSS method will gradually become mainstream, and table layout will become increasingly rare
Not many people can accurately describe the div layout rules by visual inspection. Everyone is just debugging. Just use it once.
The poster is obviously studying DIV CSS with some emotion. What you said is weird. Of course, I don’t think it is like that. Of course, the calculation method of left only counts its own coordinates. Why do we need to calculate it? What about the offset of its parent div? If you really do it like this, it would be really weird.
I think that the DIV CSS method will gradually become mainstream, and table layout will become increasingly rare
The DIV CSS layout is flexible and more suitable for web design. What the poster said The code is often seen in its web pages and is often used.
The values of right and bottom are simply ignored. So what do you need this attribute for? It's like a control panel. You don't know which button can be used and which button can't be used, but they are all there.
Why not? If there is no such attribute, then I want to put the background images of all buttons in one image. How do you set the background? Each of its attributes has its own meaning.
Now I don’t know what layout to use. I will study it later. Basically, the web page is a mess, which is really difficult for those who write browsers. .
Coupled with the incompatibility of various browsers, IE6 had a terrible share before, which made web programmers even more miserable.

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

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

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

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

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

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