• 회원가입
  • 로그인
  • 구글아이디로 로그인

[css] CSS - 반응형 마름모 갤러리 (Responsible Rhomb gallery on grids + clip-path)

 

 

<style>

HTML, BODY {

  height: 100%;

  font-size: 16px;

  line-height: 1.5;

  font-family: Trebuchet MS, Helvetica, Arial, sans-serif;

}


BODY {

  overflow: hidden;

  background: #222;

  background: linear-gradient(to right, rgba(255, 255, 255, 0.025) 10%, transparent 0), linear-gradient(#222, #000);

  background-size: .75em 100%, 100% 100%;

  display: flex;

  align-items: center;

}


.wrapper {

  position: relative;

  flex-grow: 1;

  margin: auto;

  max-width:750px ;

  max-height: 1200px;

  display: grid;

  grid-template-columns: repeat(8, 1fr);

  grid-template-rows: repeat(4, 1fr);

  grid-gap: 2vmin;

  justify-items: center;

  align-items: center;

}


IMG {

  z-index: 1;

  grid-column: span 2;

  max-width: 100%;

  margin-bottom: -52%;

  -webkit-clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);

          clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);

  -webkit-transform: scale(1);

          transform: scale(1);

  transition: all .25s;

}

IMG:nth-child(7n + 1) {

  grid-column: 2 / span 2;

}

IMG:hover {

  z-index: 2;

  -webkit-transform: scale(2);

          transform: scale(2);

}

</style>

 

<div class="wrapper">

  <img src="https://source.unsplash.com/random/600x600?water" alt="">

  <img src="https://source.unsplash.com/random/600x600?summer" alt="">

  <img src="https://source.unsplash.com/random/600x600?plants" alt="">

  <img src="https://source.unsplash.com/random/600x600?snow" alt="">

  <img src="https://source.unsplash.com/random/600x600?roses" alt="">

  <img src="https://source.unsplash.com/random/600x600?sky" alt="">

  <img src="https://source.unsplash.com/random/600x600?nature" alt="">

  <img src="https://source.unsplash.com/random/600x600?blossom" alt="">

  <img src="https://source.unsplash.com/random/600x600?ice" alt="">

  <img src="https://source.unsplash.com/random/600x600?spring" alt="">

</div>

 

결과보기

yoksel 님 https://codepen.io/yoksel/pen/PooVvwZ

 


분류 제목
css CSS - unset 속성값 - 상속값 존재 유무에 따라, inherit・initial 속성값 사용. (= …
css CSS - pointer-events 속성 - 마우스이벤트에 대한 반응 여부 (= pointer-events…
css CSS - hanging-punctuation 속성 - 문장부호 위치 지정 (= hanging-punctua…
css CSS - 자식요소 앞에 순번 붙이기 (= 번호 매기기 = 색인번호 추가 = 요소 카운팅)
css CSS - 구글 로그인 포커스 애니 효과 (Google Logn Foucs Animation Effect) …
css CSS - 이미지 세로 나열 (= 수직 정렬) 방법/경우/원인/이유
css CSS - 인스타그램(instagram) 배경색 효과
css CSS - currentcolor 키워드 - 현재 글자색 속성값을 그대로 사용 (= 커런트컬러 속성값)
css CSS - 코드펜 스타트 코딩 버튼 테두리 효과 (Codepen Start Coding Button Bord…
css CSS - translate 속성 - 2D/3D 상 요소 위치 좌표 변경 지정 (= translate속성 =…
css CSS - all 속성 - 해당요소와 그 부모요소의 모든 속성 일괄 지정 (= all속성 = 올속성)
css CSS - 화면분할 좌측사이드 영역 스크롤 고정 (= 이미지/메뉴 사이드 고정)
css CSS - 구글 번역바 숨기기/제거 (Google TranslateBar hide/remove)
css CSS - accent-color 속성 - 사용자 제어 선택요소의 색상/색깔 지정 (= accent-colo…
css CSS - box-reflect 속성 (비표준) - 요소의 반사체 생성 (= box-reflect속성 = 박…
css CSS - break-after 속성 - 지정요소 뒤에서 (페이지분할/컬럼분할/영역분할) 발생 여부 지정 (…
css CSS - break-before 속성 - 지정요소 앞에서 (페이지중단/컬럼중단/영역중단) 발생 여부 지정 …
css CSS - break-inside 속성 - 지정요소 내 (페이지중단/컬럼중단/영역중단) 발생 여부 지정 (=…
css CSS - caret-color 속성 - '입력/편집' 가능 요소의 커서 색상 변경 (= caret-colo…
css CSS - clip-path 속성 - 보일 범위 지정해 자르기 (= clip-path속성 = 클립패스속성) …
2/5
목록
찾아주셔서 감사합니다. Since 2012