1. Introduction
#The position attribute of CSS sets the positioning method of the element and defines positioning rules for the element to be positioned. This property is useful for scripting animation effects.
1. A positioned element is an element whose calculated position attribute is divided into: relative (relative), absolute (absolute), fixed (fixed) or sticky (sticky).
2. The top, right, bottom, and left attributes specify the position of the positioned element.
3. Z-index sets the stacking order of positioned elements, that is, the position of the z-axis. The value can be a positive or negative number. The larger the value, the closer it is to the user (that is, the higher the display level is. ), the smaller the value, the farther away from the user.
As shown in the figure: When the value of z-index is -1, the position of the picture is below the text and far away from the user. If the value of z-index is set to a positive number, The position of the picture is displayed above the text, covering part of the text!
And if the value of z-index is set to a positive number, the position of the image will be displayed above the text, covering part of the text! left:20px; means the distance between the picture and the left border is 20px; top:20px; means the distance between the picture and the top is 20px
2. Get The value
static
This keyword causes the element to use normal behavior, that is, the element is in the document flow Its current layout position, top, right, bottom, left and z-index properties are invalid.
relative
Use this keyword to lay out an element as if it had not been positioned. That is, it will adapt to the position of the element without changing the layout (which will leave a blank space where the element originally was). position:relative is invalid for table-*-group, table-row, table-column, table-cell, table-caption.
absolute
No space is reserved for the element. The element is positioned by specifying its offset from its nearest non-statically positioned ancestor element. to make sure. Absolutely positioned elements can have margins set and will not merge with other margins.
fixed
No space is reserved for elements. Specifies the element's space by specifying a position relative to the screen viewport, and the element's position does not change when the screen scrolls. The element will appear at a fixed position on each page when printed. The fixed attribute usually creates a new stack environment.
The above detailed explanation of the positioning method of css position setting elements is all the content shared by the editor. I hope it can give you a reference, and I hope you will support the PHP Chinese website.
For more articles related to css position setting the positioning method of elements, please pay attention to the PHP Chinese website!

If you've ever had to display an interactive animation during a live talk or a class, then you may know that it's not always easy to interact with your slides

With Astro, we can generate most of our site during our build, but have a small bit of server-side code that can handle search functionality using something like Fuse.js. In this demo, we’ll use Fuse to search through a set of personal “bookmarks” th

I wanted to implement a notification message in one of my projects, similar to what you’d see in Google Docs while a document is saving. In other words, a

Some months ago I was on Hacker News (as one does) and I ran across a (now deleted) article about not using if statements. If you’re new to this idea (like I

Since the early days of science fiction, we have fantasized about machines that talk to us. Today it is commonplace. Even so, the technology for making

I remember when Gutenberg was released into core, because I was at WordCamp US that day. A number of months have gone by now, so I imagine more and more of us

The idea behind most of web applications is to fetch data from the database and present it to the user in the best possible way. When we deal with data there

Let's do a little step-by-step of a situation where you can't quite do what seems to make sense, but you can still get it done with CSS trickery. In this


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

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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version
SublimeText3 Linux latest version

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.