inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

HTML+CSS+JS 포트폴리오 실전 퍼블리싱(시즌1)

확장선택자와 함께 가상클래스 checked 실전 퍼블리싱 04(탭 콘텐츠 - Opacity)

visibility 대신 z-index

291

rudals8920

작성한 질문수 15

1

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>2. 인접선택자-텝메뉴-Opacity</title>
  <style>
    body {
      margin0;
      displayflex;
      justify-contentcenter;
      height100vh;
      align-itemscenter;
    }

    .tab-inner {
      width300px;
      height350px;
      positionrelative;
    }

    .tab-inner input[type='radio'] {
      displaynone;
    }

    .tab-inner .content {
      positionabsolute;
      top0;
      left0;
      opacity0;
      transition1s;
    }

    .tab-inner .btn {
      width100%;
      text-aligncenter;
      positionabsolute;
      bottom0;
    }

    .tab-inner label {
      background-colorlightgrey;
      width10px;
      height10px;
      displayinline-block;
      border-radius50%;
      cursorpointer;
    }

    .tab-inner input[id='tab1']:checked~.btn label[for='tab1'],
    .tab-inner input[id='tab2']:checked~.btn label[for='tab2'],
    .tab-inner input[id='tab3']:checked~.btn label[for='tab3'] {
      background-colorcrimson;
    }

    .tab-inner input[id='tab1']:checked~.slide1,
    .tab-inner input[id='tab2']:checked~.slide2,
    .tab-inner input[id='tab3']:checked~.slide3 {
      opacity1;
      z-index1;
    }
  </style>
</head>

<body>
  <div class="tab-inner">
    <input type="radio" name="tab" id="tab1" checked>
    <input type="radio" name="tab" id="tab2">
    <input type="radio" name="tab" id="tab3">

    <div class="content slide1">
      <a href="#none1">
        <img src="./image/slide-01.jpg" alt="슬라이드이미지1">
      </a>
    </div>
    <div class="content slide2">
      <a href="#none2">
        <img src="./image/slide-02.jpg" alt="슬라이드이미지2">
      </a>
    </div>
    <div class="content slide3">
      <a href="#none3">
        <img src="./image/slide-03.jpg" alt="슬라이드이미지3">
      </a>
    </div>

    <div class="btn">
      <label for="tab1"></label>
      <label for="tab2"></label>
      <label for="tab3"></label>
    </div>
  </div>
</body>

</html>
선생님 혹시 visibility 자리에 대신 z-index를 넣어서 check 되었을 떄
check된 상품이 제일 위로 올라 오게 하는 방법은 잘못된 방법인가요?
만약 잘못된 방법이 아니라면 둘 중 어느 것이 더 선호 되는 방법인가요 ?
항상 친절한 답변 감사드립니다 ㅠ

jquery HTML/CSS

답변 3

2

코딩웍스(Coding Works)

그렇게 하셔도 됩니다.

:checked 전에 z-index보다 :checed 되었을 때 z-index를 높여주셔도 됩니다.

그런데 visiblitity가 좀 더 편하실거에요.

1

rudals8920

넵 감사합니다!!

0

은은하게

와 똑똑하세요 !! 알아갑니다

class 값 한 번에 부여하는법

2

80

1

@media에서의 flex-direction: column으로 세로배치 관련 질문드립니다.

1

69

1

div#css-checker-widget의 해결방

1

60

2

input의 포커스되었을때 검정선이 사라지지 않아요

0

79

2

강의듣는법

1

74

1

아코디언 만들기 100%이하의 화면으로 보았을때

1

68

2

input checked 질문합니다.

0

76

1

Bracket Pair Colorizer - 비주얼 스튜디오

1

140

2

Part 1 영상 안나옵니다

1

89

1

제이쿼리 작동이 안됩니다

1

199

3

강의 내용 질문있습니다.

1

120

2

일정 부분만 주석하는 방법

1

211

2

폰트어썸

1

134

2

인접선택자에 대한 질문드립니다!

1

129

2

delay 적용 안됨

1

134

1

rotateY(360deg)가 적용이 안됩니다!

1

186

2

세로이동할때 height값

1

138

2

폰트어썸이 안되요..

1

486

2

화면 정중앙에 오게끔 할수있나요?

1

169

1

어코디언 네비게이션 중

1

126

1

라이브서버 문제

1

227

2

넷플릭스 어코디언 예제 질문

1

104

1

이번 강의에선 display flex가 무조건 적으로 필요한건가요 ?

1

156

1

active 관련 질문

1

146

2