Home > Web Front-end > CSS Tutorial > Absolute positioning using CSS

Absolute positioning using CSS

WBOY
Release: 2023-09-04 12:21:02
forward
731 people have browsed it

使用 CSS 进行绝对定位

Elements with the following positions: Absolute Located at the specified coordinates relative to the upper left corner of the screen.

You can use the two values ​​top and left em> together with the position attribute to move an HTML element to any position within the HTML document.

  • Move left - use negative values > Left.
  • Move right - Use positive values ​​for left.
  • Move up - use negative values ​​for the top.
  • Move down - use positive values ​​for the top.

Example

You can try running the following code to achieve absolute positioning -
<html>
   <head>
   </head>
   <body>
      <div style = "position:absolute; left:80px; top:20px; background-color:yellow;">
         This div has absolute positioning.
      </div>
   </body>
</html>
Copy after login

The above is the detailed content of Absolute positioning using CSS. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template