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

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

<!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回答

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

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

祝学习愉快 ~

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师