position (1) 썸네일형 리스트형 CSS - 가로세로 가운데 정렬 position과 margin .position-margin { position: absolute; left: 0; right: 0; top: 0; bottom: 0; margin: auto; } 한 개의 엘레먼트가 있고 position 이 absolute일 경우 margin : auto는 먹히지 않는다. top, left, right, bottom이 없기 때문이다. 바깥여백이 만들어지지 않았다는 이야기이다. 하지만 4방위 속성들을 모두 0으로 맞추면 바깥 여백이 생겨나 버린다. 이때 margin으로 auto 속성을 부여하면 정확히 가운데 정렬이된다. flex .flex { display: flex; justify-content: center; align-items: center; } 상당히 애용하고 있.. 이전 1 다음