어떻게 만들는지: 결제 양식
- Previous Page Registration Form
- Next Page Contact Form
CSS를 사용하여 반응형 결제 양식을 만들어 보세요.
반응형 결제 양식
결제 테이블을 어떻게 만드는지
첫 번째 단계 - HTML 추가:
사용 <form> 요소를 통해 입력을 처리할 수 있습니다. 더 많은 정보를 PHP 강의에서 확인할 수 있습니다.
<div class="row"> <div class="col-75"> <div class="container"> <form action="/action_page.php"> <div class="row"> <div class="col-50"> <h3>Billing Address</h3> <label for="fname"><i class="fa fa-user"></i> Full Name</label> <input type="text" id="fname" name="firstname" placeholder="John M. Doe"> <label for="email"><i class="fa fa-envelope"></i> Email</label> <input type="text" id="email" name="email" placeholder="john@example.com"> <label for="adr"><i class="fa fa-address-card-o"></i> Address</label> <input type="text" id="adr" name="address" placeholder="542 W. 15th Street"> <label for="city"><i class="fa fa-institution"></i> City</label> <input type="text" id="city" name="city" placeholder="New York"> <div class="row"> <div class="col-50"> <label for="state">State</label> <input type="text" id="state" name="state" placeholder="NY"> </div> <div class="col-50"> <label for="zip">Zip</label> <input type="text" id="zip" name="zip" placeholder="10001"> </div> </div> </div> <div class="col-50"> <h3>Payment</h3> <label for="fname">Accepted Cards</label> <div class="icon-container"> <i class="fa fa-cc-visa" style="color:navy;"></i> <i class="fa fa-cc-amex" style="color:blue;"></i> <i class="fa fa-cc-mastercard" style="color:red;"></i> <i class="fa fa-cc-discover" style="color:orange;"></i> </div> <label for="cname">Name on Card</label> <input type="text" id="cname" name="cardname" placeholder="John More Doe"> <label for="ccnum">Credit card number</label> <input type="text" id="ccnum" name="cardnumber" placeholder="1111-2222-3333-4444"> <label for="expmonth">Exp Month</label> <input type="text" id="expmonth" name="expmonth" placeholder="September"> <div class="row"> <div class="col-50"> <label for="expyear">만료 연도</label> <input type="text" id="expyear" name="expyear" placeholder="2018"> </div> <div class="col-50"> <label for="cvv">CVV</label> <input type="text" id="cvv" name="cvv" placeholder="352"> </div> </div> </div> </div> <label> <input type="checkbox" checked="checked" name="sameadr"> 배송 주소가 청구 주소와 동일 </label> <input type="submit" value="결제 페이지로 이동" class="btn"> </form> </div> </div> <div class="col-25"> <div class="container"> <h4>장바구니 <span class="price" style="color:black"> <i class="fa fa-shopping-cart"></i> <b>4</b> </span> </h4> <p><a href="#">제품 1</a> <span class="price">$15</span></p> <p><a href="#">제품 2</a> <span class="price">$5</span></p> <p><a href="#">제품 3</a> <span class="price">$8</span></p> <p><a href="#">제품 4</a> <span class="price">$2</span></p> <hr> <p>총 <span class="price" style="color:black"><b>$30</b></span></p> </div> </div> </div>
第二步 - 추가 CSS:
CSS Flexbox를 사용하여 반응형 레이아웃을 생성하십시오:
.row { display: -ms-flexbox; /* IE10 */ display: flex; -ms-flex-wrap: wrap; /* IE10 */ flex-wrap: wrap; margin: 0 -16px; } .col-25 { -ms-flex: 25%; /* IE10 */ flex: 25%; } .col-50 { -ms-flex: 50%; /* IE10 */ flex: 50%; } .col-75 { -ms-flex: 75%; /* IE10 */ flex: 75%; } .col-25, .col-50, .col-75 { padding: 0 16px; } .container { background-color: #f2f2f2; padding: 5px 20px 15px 20px; border: 1px solid lightgrey; border-radius: 3px; } input[type=text] { width: 100%; margin-bottom: 20px; padding: 12px; border: 1px solid #ccc; border-radius: 3px; } label { margin-bottom: 10px; display: block; } .icon-container { margin-bottom: 20px; padding: 7px 0; font-size: 24px; } .btn { background-color: #04AA6D; color: white; padding: 12px; margin: 10px 0; border: none; width: 100%; border-radius: 3px; cursor: pointer; font-size: 17px; } .btn:hover { background-color: #45a049; } span.price { float: right; color: grey; } /* 반응형 레이아웃 - 스크린 너비가 800px보다 작을 때, 두 열이 가로로 대신 접기(방향을 변경 - '장바구니' 열을 상단에 배치) */ @media (max-width: 800px) { .row { flex-direction: column-reverse; } .col-25 { margin-bottom: 20px; } }
Related Pages
Tutorial:HTML 양식
Tutorial:CSS 양식
Tutorial:CSS Flexbox
- Previous Page Registration Form
- Next Page Contact Form