What are the categories of relative positioning?
Relative positioning includes classification according to positioning method, classification according to positioning direction, classification according to positioning distance and classification according to positioning reference object. Detailed introduction: 1. Classification according to positioning method includes static positioning, relative positioning, absolute positioning and fixed positioning; 2. Classification according to positioning direction includes horizontal positioning and vertical positioning; 3. Classification according to positioning distance includes static positioning, relative positioning, Absolute positioning and fixed positioning; 4. Classification according to positioning reference objects includes static positioning, relative positioning, absolute positioning and fixed positioning.
The operating system for this tutorial: Windows 10 system, DELL G3 computer.
Relative positioning is a commonly used method in image layout, which can be classified according to different needs and scenarios. The following are some common relative positioning classification methods:
1. Classification based on positioning methods
Static positioning (static): Static positioning is the default positioning method of elements. Arrange according to normal document flow. In this positioning method, the element will not be affected by top, right, bottom and The influence of attributes such as left.
Relative positioning (relative): Relatively positioned elements are adjusted according to their position in the normal document flow. You can set top, right, bottom and left and other attributes to change the position of the element. Relatively positioned elements remain in the document flow and have no impact on other elements.
Absolute positioning (absolute): Absolutely positioned elements will break away from the document flow, relative to their nearest non-static The positioned ancestor element is positioned. If there are no ancestor elements, positioning is relative to the original containing block of the document. You can set top, right, bottom and left and other attributes to change the position of the element. Absolutely positioned elements have an impact on other elements.
Fixed positioning (fixed): Fixed-positioned elements will break away from the document flow and be positioned relative to the browser window. You can set top, right, bottom and left and other attributes to change the position of the element. Fixed positioned elements have an impact on other elements.
2. Classification based on positioning direction
Horizontal positioning: Horizontal positioning means that an element is positioned in the horizontal direction relative to its ancestor elements. This can be achieved by setting the left and right properties.
Vertical positioning: Vertical positioning means that an element is positioned vertically relative to its ancestor elements. This can be achieved by setting the top and bottom properties.
3. Classification based on positioning distance
Static positioning: statically positioned elements will be adjusted according to their position in the normal document flow, but will not change the relationship between elements relative distance.
Relative positioning: Relatively positioned elements will be adjusted according to their position in the normal document flow. You can set top, right, bottom and left and other properties to change the relative distance between elements.
Absolute positioning: An absolutely positioned element will leave the document flow and be positioned relative to its nearest non-statically positioned ancestor element. The relative distance between elements is determined by top, right, bottom and Determined by properties such as left.
Fixed positioning: Fixed-positioned elements will break away from the document flow and be positioned relative to the browser window. The relative distance between elements is determined by properties such as top, right, bottom, and left.
4. Classification based on positioning reference objects
Static positioning: statically positioned elements will be adjusted according to their position in the normal document flow. The reference object is the element in the normal document flow. The position in the document flow.
Relative positioning: Relatively positioned elements will be adjusted according to their position in the normal document flow. The reference is the position of the element in the normal document flow.
Absolute positioning: Absolutely positioned elements will break away from the document flow, relative to their nearest non-static The positioned ancestor element is positioned. The reference is the position of the ancestor element. If there are no ancestor elements, positioning is relative to the original containing block of the document.
Fixed positioning: Fixed-positioned elements will break away from the document flow and be positioned relative to the browser window. The reference object is the position of the browser window.
In short, relative positioning can be classified according to different needs and scenarios. Understanding these classification methods will help you better master the use of relative positioning and achieve more flexible image layout.
The above is the detailed content of What are the categories of relative positioning?. For more information, please follow other related articles on the PHP Chinese website!

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



Does sticky positioning break away from the document flow? Specific code examples are needed. In web development, layout is a very important topic. Among them, positioning is one of the commonly used layout techniques. In CSS, there are three common positioning methods: static positioning, relative positioning and absolute positioning. In addition to these three positioning methods, there is also a more special positioning method, namely sticky positioning. So, does sticky positioning break away from the document flow? Let’s discuss it in detail below and provide some code examples to help understand. First, we need to understand what document flow is

Bottom attribute syntax and code examples in CSS In CSS, the bottom attribute is used to specify the distance between an element and the bottom of the container. It controls the position of an element relative to the bottom of its parent element. The syntax of the bottom attribute is as follows: element{bottom:value;} where element represents the element to which the style is to be applied, and value represents the bottom value to be set. value can be a specific length value, such as pixels

To center the box in HTML5, there are the following methods: horizontal centering: text-align: centermargin: autodisplay: flex; justify-content: center; vertical centering: vertical-align: middletransform: translate(-50%, -50%); position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);

There are four methods of CSS element positioning: static, relative, absolute, and fixed positioning. Static positioning is the default and the element is not affected by positioning rules. Relative positioning moves an element relative to itself without affecting document flow. Absolute positioning removes an element from the document flow and positions it relative to its ancestor elements. Fixed positioning positions an element relative to the viewport, always keeping it in the same position on the screen.

Since the "AttentionIsAllYouNeed" paper published in 2017, the Transformer architecture has been a cornerstone of the natural language processing (NLP) field. Its design has remained largely unchanged for years, with 2022 marking a major development in the field with the introduction of Rotary Position Encoding (RoPE). Rotated position embedding is the state-of-the-art NLP position embedding technique. Most popular large-scale language models (such as Llama, Llama2, PaLM and CodeGen) already use it. In this article, we’ll take a deep dive into what rotational position encodings are and how they neatly combine the benefits of absolute and relative position embeddings. The need for positional encoding in order to understand Ro

Layout refers to a typesetting method adopted in web design to arrange and display web page elements according to certain rules and structures. Through reasonable layout, the webpage can be made more beautiful and neat, and achieve a good user experience. In front-end development, there are many layout methods to choose from, such as traditional table layout, floating layout, positioning layout, etc. However, with the promotion of HTML5 and CSS3, modern responsive layout technologies, such as Flexbox layout and Grid layout, have become

Relative positioning technologies include radio ranging, sonar, laser ranging, cameras, inertial navigation, satellite navigation, indoor positioning, ultrasonic, infrared, electromagnetic waves, Bluetooth positioning, Wi-Fi positioning, ultrasonic ranging, infrared ranging, and laser ranging. , camera visual positioning, RSSI-based positioning, TOA-based positioning, TDOA-based positioning, AOA-based positioning, etc. Detailed introduction: 1. Radio ranging: Calculate the distance by measuring the time difference of radio waves from the transmitting point to the receiving point; 2. Sonar technology, etc.

Methods for aligning text boxes in html: 1. Text alignment; 2. Use Flexbox layout alignment; 3. Use Grid layout alignment; 4. Use margin or position for fine-tuning.