Home >Web Front-end >CSS Tutorial >What is the use of the absolute attribute in the CSS position attribute?

What is the use of the absolute attribute in the CSS position attribute?

怪我咯
怪我咯Original
2017-06-22 10:20:073466browse

css positioning Parameters: position, left, right, top, bottom

Parameter description:
absolute Parameters are used to specify the positioning method of the block. Top, bottom, left, and right specify the up, down, left, and right coordinates of the block respectively.
Parameter value description.

  • absolute:Absolute positioning

  • ##fixed: Fixed positioning


  • relative: relative positioning


  • static: static positioning

Sample code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>示例网页</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
.c1{
    width:200px;
    height:150px;
    line-height:75px;
    text-align:center;
    border:1px solid #909;
    position:absolute;
    top:50px;
    left:50px;
}
</style>
</head>
<body>
<div class="c1">
本方块宽200px,高150px,绝对定位于上边50px,左边50px
</div>
</body>
</html>

The above is the detailed content of What is the use of the absolute attribute in the CSS position attribute?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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