• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 HTML/CSS 게시판 position 숙제 z-index 질문입니다 ㅠㅠㅠ

position 숙제 z-index 질문입니다 ㅠㅠㅠ

3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 글쓴이
  • #117611

    김지우
    참가자
    HTML
    
    <body style="margin: 0;">
        <div class="main-background">
            <h4 class="main-title">Buy Our Shoes!</h4>
            <p class="main-text">Very cool and nice shoes! very good!</p>
            <button class="main-button">구매하기</button>
        </div>  
        
        <div class="explain-box">
            <h4>how we design our shoes</h4>
            <p>how we design our shoes?how we design our shoes?how we design our shoes?how we design our shoes?</p>
        </div>
    </body>
    
    
    
    CSS
    .main-background {
        width: 100%;
        height: 500px;
        background-image: url(img/shoes.jpg);
        background-size: cover;
        background-repeat: no-repeat;
        background-position: center;
        filter: brightness(70%);
        padding: 1px;
    }
    .main-title {
        color: white;
        font-size: 40px;
        margin-top: 50px;
        margin-bottom: 20px;
        text-align: center;
    }
    .main-text {
        color: white;
        font-size: 20px;
        margin-top: 10px;
        text-align: center;
    }
    .main-button {
        padding: 15px;
        font-size: 20px;
        background: white;
        border: none;
        border-radius: 5px;
        position: absolute;
        left: 0;
        right: 0;
        margin: auto; /* 가로 중앙 정렬 */
        width: 150px;
        z-index: 2; /* explain-box보다 위에 위치하도록 조정 */
    }
    .explain-box {
        width: 700px;
        margin: auto;
        padding: 20px;
        text-align: center;
        background-color: #eee;
        position: relative;
        top: -300px;
        z-index: 1;
    }
    
    혹시 잘못 작성한 부분 있나 체크도 계속 하고 아예 그냥 새로 작성도 해봤는데 
    아무리 해도 main-button(구매하기 버튼)이 explain-box보다 위에 오게 배치가 안됩니다 ㅠㅠㅠㅠ 대체 어느부분이 잘못된건지 모르겠습니다.
    
    문제
    
    
    #117626

    codingapple
    키 마스터
    .explain-box에도 position absolute 줘봅시다
    #117879

    김지우
    참가자
    저번에 다른분이 질문하신거 답변남긴거 보고 해결했습니다. ㅠㅠ filter 속성이 문제였던것 같네요. filter만 없애니깐 정상 적용되었습니다.
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠