小编use*_*581的帖子

解释这个绝对位置的css行为

我想知道css中的这种行为是否正常,为什么?我的问题是关于立场:绝对; 我有两个div,第一个包含图像时,它位于绝对位置0底部和右0它粘在页面的末尾(但不是真实页面的结尾,但页面结束显示视图)注意它没有任何具有绝对或固定或相对位置的父级

JSbin Demo

图像到结果 这是一个完整的代码

<!DOCTYPE html>
<html>
<head>
    <title></title>

    <style>
        body {
            background: #808080;
            /*height:1200px;*/
        }

        .content {
            background: rgba(0, 148, 255, 0.69);
            /*min-height:400px;*/
            width: 900px;
            margin: 0 auto;
            border: 6px groove #00ff90;
        }


        h1 {
            position: relative;
            top: 5px;
            right: 5px;
        }

        p {
            /*position: relative;*/
            /*top: 150px;*/
            /*right: 5px;*/
        }


        img {
            border: 3px groove #0ff;
            width: 400px;
            position: absolute;
            /*top:0px;
    right:0px;*/
            bottom: 0px;
            right: 0px;
        }
    </style>
</head>
<body>
    <div class="content">
        <h1>why we should using reletive …
Run Code Online (Sandbox Code Playgroud)

html css layout css-position

3
推荐指数
1
解决办法
136
查看次数

标签 统计

css ×1

css-position ×1

html ×1

layout ×1