老师我的红框总是偏右一点,麻烦看一下

来源:2-5 position-relative

qq_慕先生2229342

2020-04-16 15:50:29

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>position-relative</title>

    <style>

        *{

            margin: 0px;

            padding: 0px;

        }

        .block{

            position: relative;

            top: 0px;

            left: 0px;

            width: 80px;

            height: 80px;

            line-height: 80px;

            border: 2px solid black;

            text-align: center;

            float: left;

        }

        .block:nth-child(2){

            position: relative;

            top: 0px;

            left: -80px;

            border: red 2px solid;

        }

    </style>

</head>

<body>

    <div class="block">A</div>

    <div class="block">B</div>

</body>

</html>


写回答

1回答

好帮手慕夭夭

2020-04-16

同学你好,相同问题已经回答了,请查看一下吧。

https://class.imooc.com/course/qadetail/214582

祝学习愉快 ~

0

0 学习 · 40143 问题

查看课程