[CSS Battle - 11] 1-11. Eye of Sauron

2023. 4. 11.·🎨 프론트엔드 공부/HTML & CSS

📍타겟 이미지

 

📍문제 풀이

✅z-index를  활용하여 우선순위를 낮춰서 겹치는 레이어를 구현한다

- z-index를 사용할 때는 position이 default 이외 어떤 것이든 적용되어야 함을 유의

 

✅반원형은 border-radius를 각 꼭지점에 적용하여 구현한다

- border-raduis: 11시 2시 5시 8시 방향 순이다

 

📍코드

<main>
  <div id="first" class="size-m circle">
    <div class="up rect dark"></div>
    <div class="down rect yellow"></div>
    <div class="size-s circle dark"></div>
  </div>
  <div id="second" class="size-m circle dark">
    <div class="size-s circle"></div>
  </div>
  <div id="third" class="size-m circle">
    <div class="up rect yellow"></div>
    <div class="down rect dark"></div>
    <div class="size-s circle dark"></div>
  </div>
  <div class="size-l circle yellow"></div>
</main>
<style>
	body {
		background: #191210;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	main {
		display: flex;
		position: relative;
	}
	.rect {
		width: 100px;
		height: 50px;
	}
	.circle {
		border-radius: 50%;
	}
	.dark {
		background: #191210;
	}
	.yellow {
		background: #ECA03D;
	}
	#first {
		position: relative;
		z-index: -5;
	}
	#first .down {
		border-radius: 0 0 50px 50px;
	}
	#first .size-s {
		background: #191210;
		position: absolute;
		top: 20%;
		left: 20%;
	}
	#second {
		background: #191210;
		position: relative;
	}
	#second .size-s {
		background: #84271C;
		position: absolute;
		top: 25%;
		left: 25%;
		z-index: 99;
		width: 50px;
		height: 50px;
	}
	#third {
		position: relative;
		z-index: -5;
	}
	#third .up {
		border-radius: 50px 50px 0 0;
	}
	#third .size-s {
		background: #191210;
		position: absolute;
		top: 20%;
		left: 20%;
	}
	.size-s {
		width: 60px;
		height: 60px;
	}
	.size-m {
		width: 100px;
		height: 100px;
	}
	.size-l {
		width: 140px;
		height: 140px;
		position: absolute;
		top: -20%;
		left: 26.5%;
		z-index: -1;
	}
</style>

 

📍결과

100% match

 

 

'🎨 프론트엔드 공부/HTML & CSS' 카테고리의 다른 글
  • styled-components로 프로젝트를 시작할 때 참고할 만한 사례
  • 반응형 헤더 구현하기
  • [CSS Battle - 10] 1-10. Cloaked Spirits
  • scss variables
지식물원
지식물원
지식이 자라는 식물원!
  • 지식물원
    지식물원
    지식물원
  • 전체
    오늘
    어제
    • 분류 전체보기 (516)
      • 🎨 프론트엔드 공부 (253)
        • JS & TS (92)
        • HTML & CSS (22)
        • React & Next (49)
        • Vue & Nuxt (22)
        • 기타 (68)
      • 🤓 기술 학습 & 공부 기록 (116)
        • Node.js (0)
        • Python (37)
        • 백엔드 (0)
        • 딥러닝 (1)
        • 컴퓨터 일반 (72)
        • 개발 인프라 (6)
      • 👨‍💻 프로젝트 경험 (6)
        • Work (0)
        • Toy (6)
      • ⚙️ 개발 팁 & 노하우 (21)
        • 프론트엔드 (6)
        • 기타 (15)
      • ☕️ 커리어 & 인터뷰 준비 (88)
        • 코딩 테스트 (88)
      • 📰 기술 트렌드 & 생각 정리 (4)
      • 📚 기타 (25)
        • 마케팅 (15)
        • 비개발서적 (10)
  • 블로그 메뉴

    • 태그
  • 링크

  • 공지사항

    • 모바일 접속 시 코드 하이라이팅 깨질 때
  • 인기 글

  • hELLO· Designed By정상우.v4.10.3
지식물원
[CSS Battle - 11] 1-11. Eye of Sauron
상단으로

티스토리툴바