絶対的相対的な位置決めのCSS_

練習

図に示される完全場合。

Html页面具体实现
<Html>
<head>
<stylen type="text/css">

</style>
</head>

<body>
//最外边的边框
<div class="div0">
<div class="div1">
<div class="div2">5</div>
<img  class=“img”src="img/shopping.jpg">
</div>
</div>
</body>
</Html>
复制代码

CSSスタイルの表示

.div{
    width:500px;
    height:500px;
    //父类用的定位是相对定位
    position:relative;
    background-color:#` 667766;
    top:150px;
    left:300px;
}
.img{
    width:25px;
    height:25px;
    //子类用绝对定位
    position:absolute;
    bottom:0px;
    left:270px;
}
.div1{
    width:300px;
    height:200px;
    background-color:red;
    position:absolute;
    top:50px;
    left:100px;
}
.div2{
    width:30px;
    height:20px;
    border-radius:30px/20px;
    background-color:blue;
    color:white;
    text-align:center;
    position:absolute;
    top:-5px;
    left:-5px;
    line-height:20px;
}
复制代码

概要:絶対位置との相対位置、サブDIVとその親のdiv、私たちはケースを完了することができます

ます。https://juejin.im/post/5cfc912651882522d47f13ffで再現

おすすめ

転載: blog.csdn.net/weixin_33978044/article/details/91437244