<div class="box1">
<div class="box2">黄色のbox2を、box1に対して、幅を50%、高さを50%にしたらこうなるよ</div>
</div>
.box1 {
background: skyblue;
width: 200px;
height: 200px;
}
.box2 {
background: yellow;
width: 50%;
height: 50%;
overflow: hidden;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.