Related usage of css_position_html/css_WEB-ITnose
Introduction
position is used to fix the position and is a particularly important attribute
The value can be:
1 <style type="text/css"> 2 div 3 { 4 position:100px 100px; 5 width:100px; 6 height:100px; 7 border:5px solid black; 8 } 9 div.pos_left10 {11 position:relative;12 left:-20px;13 border:5px solid green;14 }15 div.pos_right16 {17 position:relative;18 left:20px;19 border:5px solid green;20 }21 div.pos_ab22 {23 position:absolute;24 left:30px;25 top:50px;26 border:5px solid blue;27 }28 div.main29 {30 position:absolute;31 left:100px;32 top:50px;33 width:200px;34 height:300px;35 border:5px solid red;36 }37 div.pos_fix38 {39 position:fixed;40 left:10px;41 top:0px;42 clip:rect(0px 50px 200px 0px);43 }44 </style>45 </head>46 47 <body>48 <div class="main">49 <div>1.normal</div>50 <div class="pos_left">2.re-left:-20px</div>51 <div class="pos_right">3.re-left:20px</div>52 <div class="pos_ab">4.ab-(left:30px,top:50px)</div>53 <div class="pos_right">5.re-left:20px</div>54 <div class="pos_fix">6.fix-(left:30px,top:50px)</div>55 </div>
Among them:
When setting position: relative
, refer to the parent middle-top The upper left corner of the content area of a child element is positioned using the original point combined with the TRBL attribute. If there is no parent, the upper left corner of the BODY is used as the original point
?? It must be noted that the upper left corner relative to the previous child element is not the upper left corner shown in the 2 to 3 picture. In other words, if [2] is static, the upper left corner will not be TRBL transformed.
??That is, even if the relative element is TRBL transformed, the interval it occupies is still the original interval, so it will cover other elements.
More obvious display:
Change [2] in the picture:
position: relative;
left:-20px;
top:-50px;
Then:
An area in the figure that contains the blank areas above and below [2] and [3] is [ 2】Really occupied space
. When setting position: relative
, refer to the upper left corner of the parent The corner is positioned as the original point combined with the TRBL attribute. If there is no parent, the upper left corner of the browser is the original point
At the same time, we can see from the relative attribute [5]?? [5] is relative to the space of [3]
?? Absolute is equivalent to directly covered without possessing real space
When setting the position: related The upper left corner is the original point
In addition

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

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

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

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

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...
