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

home2 게시판 HTML/CSS 게시판 cart-layout 숙제

cart-layout 숙제

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

    이정미
    참가자

    선생님 질문이 있습니다. 
    테이블 태그 밑에 디브 태그(edit your shopping cart, payment method)추가해서 레이아웃을 만들었는데 왜 cart-background에 적용한 백그라운드 컬러가 적용이 안되는지 모르겠어요 그래서 디브 태그에 클래스 주고 백그라운드 컬러 적용 해도 안먹어요 처부 파일로 html, css 파일 올려요 도와주세요 

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link href="css/cart.css" rel="stylesheet">
    </head>
    <body>
    <div class="cart-background">
    <h2>Your shopping cart</h2>
    <table class="cart-table">
    <thead>
    <tr>
    <td></td>
    <th>ITEM</th>
    <th>Amount</th>
    <th>PRICE</th>
    <th>TOTAL</th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td></td>
    <td>
    <h3>SONY</h3>
    <p>FE 70-200mm F2.8 GM OSS</p>
    </td>
    <td>1</td>
    <td>$1979.00</td>
    <td>$1979.00</td>
    </tr>
    <tr>
    <td></td>
    <td>
    <h3>SONY</h3>
    <p>Sonnar T* E 24mm F1.8 ZA OSS</p>
    </td>
    <td>1</td>
    <td>$989.00</td>
    <td>$989.00</td>
    </tr>
    <tr>
    <td class="td-total" colspan="4"></td>
    <td class="td-total"><h3>$2968.00</h3></td>
    </tr>
    </tbody>
    </table>
    <div class="edit-cart">
    <p>Edit your shopping cart</p>
    <button>choose payment method</button>
    </div>
    </div>
    </body>
    </html>

     

     

    .cart-background {
    background-color: rgb(186, 221, 245);
    width: 100%;
    max-width: 700px;
    padding: 30px;
    }
    .cart-background h2 {
    font-size: 30px;
    font-weight: bold;
    text-align: left;
    margin: 30px auto;
    }
    .cart-table {
    margin: auto;
    border-collapse: collapse;
    background-color: white;
    border-radius: 5px;
    }
    img {
    width: 60px;
    }

    h3, p{
    margin: 5px;
    }
    .cart-table th,.cart-table td {
    text-align: center;
    padding: 10px;
    border-bottom: 1px solid black;
    }
    .td-total{
    border: none;
    }
    .edit-cart {
    position: relative;
    background-color: rgb(186, 221, 245);
    width: 100%;
    max-width: 700px;
    }
    .edit-cart p {
    position: absolute;
    left: 50px;
    top: 50px;
    border-bottom: 1px solid lightslategray;
    }
    .edit-cart button {
    float:right;
    margin-top: 30px;
    margin-right: 200px;
    }
    .edit-cart button {
    padding: 20px;
    background-color: rgb(83, 83, 236);
    font-size: 18px;
    color: white;
    border: none;
    border-radius: 5px;
    position: absolute;
    top: 10px;
    right: -150px;
    }

    #17816

    codingapple
    키 마스터

    그대로 붙여넣기 해보니까 테이블 바깥에 하늘색 배경 잘보이는디유 

    #17830

    이정미
    참가자

    그게 아니라 선생님 테이블 백그라운드 컬러는 잘 나오는데 선생님 예제처럼 테이블 태그 밑에 디브 태그(edit your shopping cart, payment method)에도 테이블이랑 같은 백그라운드 컬러를 적용하고 싶어서유 

    #17833

    codingapple
    키 마스터

    그 안에 있는 버튼과 p 태그를 둘다 position : absolute줘서 공중에 띄워놔서 그렇습니다

    안에있는걸 전부 공중에 띄워놓으니까 부모 <div> 박스가 높이가 0이 된듯합니다 

    #17838

    이정미
    참가자

    그럼 z-index로 수정을 하면 되나요??

     

    #17848

    codingapple
    키 마스터

    position으로 공중에 띄우지 말거나

    부모 <div> 박스에 height를 주거나 하면 됩니다 

6 글 보임 - 1 에서 6 까지 (총 6 중에서)
  • 답변은 로그인 후 가능합니다.

About

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

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

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