공부하며 모르거나 헷갈렸던 내용을 정리중입니다.
페이지 제작중 반응형 정사각형 만드는곳에서 막혔다.
width, height 크기를를 px이나 %로 아무리해도 답이 없었다.
구글링을 통해 방법을 찾았고 아래와 같다.
<div class="box">
<img class="content" src="https://images" alt="images"/>
</div>
여기까지가 반응형 정사각형 만드는 방법이고, 만약 컨텐츠가 있다면,
.box {
position: relative;
width: 50%;
background-color: skyblue;
}
.box::after {
display: block;
content: "";
padding-bottom: 100%;
}
.content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 50%;
}