


A big problem~~~Style problem~~~I found that I couldn't think of a solution_html/css_WEB-ITnose
<!DOCTYPE html> <head> <style>#wrapper{width:800px;position:absolute;left:50%;margin-left: -400px;height:300px;border:1px solid red} </style> <body> <div id="wrapper"></div> </body></html>
The web page presents a div in the center,
What we need to do now is, [immediately after] this div, add a div below it,
For example,
The next meaning is that directly below the div with the id of wrapper, the left end is at the same distance, and the top is connected to the above div
It’s quite difficult to find~~~~
Reply to the discussion (solution)
The style of the body is: text-align:center;
The following div: width: 960px; margin:0 auto;
The style of the body is: text-align:center;
The following div: width:960px; margin:0 auto;
<!DOCTYPE html> <head> <style>#wrapper{width:800px;position:absolute;left:50%;margin-left: -400px;height:300px;border:1px solid red} </style> <body style="text-align:center;"> <div style="width:960px;margin:auto;"> <div id="wrapper"></div> <div>123</div> </div> </body></html>
That should be enough, isn’t that what you meant?
Of course not~~~~123 is inside the wrapper. Of course it is wrong~~
Use float, clear
123 is outside the wrapper
The wrapper is absolutely positioned. If you want 123 to be directly below the wrapper, then 123 must also be positioned absolutely
Is this very confusing?
123 is outside the wrapper
The wrapper is absolutely positioned. If you want 123 to be directly below the wrapper, then 123 must also be absolutely positioned
Is this very confusing?
In order to facilitate observation, I set the height of this wrapper to be fixed. In actual application, the height of the wrapper is obviously adaptive.
So it is difficult~~~~
I feel that the style problem is not a problem, but I don’t understand what you mean now
How about you draw a rendering (simple and clear), the absolute positioning is not very reliable, and the resolution is different , will be misaligned
What’s so incomprehensible about this?
The style he mentioned is: what it looks like when you intercept the two areas of "reply to" and "I feel"
The former is a wrapper and the latter is 123
Since the wrapper is absolutely positioned, So 123 must also be positioned absolutely. That is, the upper left corner of 123 should coincide with the lower left corner of the wrapper
If the height of the wrapper is adaptive, then 123 must dynamically obtain the height of the wrapper to achieve positioning. This cannot be achieved without the participation of js
Of course, it is much simpler to use relative positioning or without div
Dear, you can take a look at this, I adjusted it a little
<!DOCTYPE html> <head> <style>#wrapper{width:800px;position:absolute;left:50%;margin-left: -400px;height:300px;border:1px solid red}#wrapper2{position:absolute;width:40px;height:40px;border:1px solid green;left:50%;top:310px} </style> <body><div id="wrapper"></div><div id="wrapper2">123</div> </body></html>
<!doctype html><html><head><style>* {padding:0px;margin:0px;}body {background:#ccc;}#page {width:802px;margin-left:auto;margin-right:auto;margin-top:10px;}#wrapper1 {width:800px;height:300px;border:1px solid red;background:white;}#wrapper2 {width:800px;height:300px;border:1px solid blue;background:white;}</style></head><body><div id="page"><div id="wrapper1">div1</div><div id="wrapper2">div2</div></div></body></html>
Points for perfect solution
solid red;}
position:absolute;left:50%;margin-left: -400px;height:300px;border:1px solid red;top:310px">123

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.

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.


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

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

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

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

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